Adobe Dreamweaver Forums



Last 10 THreads :         Change html page image by the month (Last Post : Steve Zavodny - Replies : 18 - Views : 19 )           »          suggestions for a loop to load text files (Last Post : chopTheWood - Replies : 0 - Views : 1 )           »          how do I create a chain reaction? (Last Post : LostFlashGirl - Replies : 1 - Views : 2 )           »          Problems with drag (Last Post : CatBandit - Replies : 1 - Views : 3 )           »          Editing Quiz (Last Post : CatBandit - Replies : 1 - Views : 2 )           »          cross browser issue? (Last Post : bmilesp - Replies : 0 - Views : 1 )           »          Custom Preloader (Last Post : NedWebs - Replies : 1 - Views : 2 )           »          Suddenly can't see files on remote server (Last Post : GDrink9085 - Replies : 9 - Views : 10 )           »          how do I add a table to a preformed template that I got? (Last Post : Murray *ACE* - Replies : 8 - Views : 13 )           »          Adobe Flash 10 kills Wimpy (Last Post : midiwriter - Replies : 42 - Views : 259 )           »         


Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
User Info Statistics
Go Back   Adobe Dreamweaver Forums > Other Macromedia/Adobe Products > Flex
 
Tags: , ,



Reply
  #1 (permalink)  
Old 07-22-2008, 04:24 PM
chuckhodge
 
Posts: n/a
Diggs:
Default asfunction equivalent for Flex

I have html from an xml file that gets loaded into a text field. looks like
this:
<a href='asfunction:displaySub,Audio Control Module (ACM)'><font
color='#0000FF'>Audio Control Module (ACM)</font></a>
In the Flash app when the user clicks on this link it calls the displaySub
function and passes the value "Audio Control Module (ACM)" to it.
In Flex I have gotten it to fire displaySub but not sure if it is passing the
string or how I would go about retrieving that value.
Any thoughts?



Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-22-2008, 04:46 PM
g-s-b
 
Posts: n/a
Diggs:
Default Re: asfunction equivalent for Flex

Perhaps...

<a href='asfunction:displaySub," ' + String( Audio Control Module (ACM) ) + ' " '>


Reply With Quote
  #3 (permalink)  
Old 07-22-2008, 05:01 PM
chuckhodge
 
Posts: n/a
Diggs:
Default Re: asfunction equivalent for Flex

that actually kills the string. remember, this is being pulled from an xml file and assigned to a text field in Flex.
Reply With Quote


  #4 (permalink)  
Old 07-22-2008, 07:15 PM
g-s-b
 
Posts: n/a
Diggs:
Default Re: asfunction equivalent for Flex

Ah yes....

In your case, "Audio Control Module (ACM)" is sent to the 'displaySub()' as a
string - 'Audio Control Module (ACM)'

So at best:
function displaySub( str:String ) : void { trace( str ); }

...should trace:
Audio Control Module (ACM)

...no?


Reply With Quote
  #5 (permalink)  
Old 07-22-2008, 08:17 PM
GraspDiver
 
Posts: n/a
Diggs:
Default Re: asfunction equivalent for Flex

returns nothing at all. here's the code, this will trace:

[Bindable(event="click")]
private function displaySub():void {
trace("here = ");
}

<mx:Text x="10" y="10" width="752" id="full" htmlText="{textdata}"
enabled="true" fontSize="12" fontFamily="Arial" leading="0" resize="true"
selectable="true" click="displaySub()"/>

if I add a variable to the function, it will not. I need to add a value to
the calling control (mx:Text) and this is where it falls apart because it is
not the link in the text that actually calls the function but the mx control. I
need to get the link to call the function. (I've tried the link method of the
text control but that didn't seem to work as well - could still be my not fully
understanding how these things are really working)


Reply With Quote
  #6 (permalink)  
Old 07-23-2008, 12:14 AM
adudas
 
Posts: n/a
Diggs:
Default Re: asfunction equivalent for Flex

I added a listener to my textfield using TextEvent.LINK and was able to fire off a function from a link in the text field. Dunno if that helps.


Reply With Quote


  #7 (permalink)  
Old 07-24-2008, 06:10 PM
GraspDiver
 
Posts: n/a
Diggs:
Default Re: asfunction equivalent for Flex

I tried the link= method of the textfield but was unable to ge the compiler to
recognize the id name of the textfield when trying to establish a listener in
code (full.addListener(...)).If there is a different way to attach a listener
to a textfield please let me know. There has to be a way this works in Flex if
it already works in Flash.

Reply With Quote
  #8 (permalink)  
Old 07-24-2008, 09:43 PM
ntsiii
 
Posts: n/a
Diggs:
Default Re: asfunction equivalent for Flex

asfunction no longer exists in AS and is replaced by the TextEvent link event.

Do this:
<a href='event:mytext)' ...

And access "mytext" in the listener:
private function onTextLinkClick(event:TextEvent):void {
var sMyText:String = event.text;

The TextEvent bubbles, so you can listen for it most anywhere.

Tracy

Reply With Quote
  #9 (permalink)  
Old 07-25-2008, 03:31 PM
GraspDiver
 
Posts: n/a
Diggs:
Default Re: asfunction equivalent for Flex

thanks everyone for your help on this.
Reply With Quote


  #10 (permalink)  
Old 07-25-2008, 04:09 PM
GraspDiver
 
Posts: n/a
Diggs:
Default Re: asfunction equivalent for Flex

New wrinkle: I'm getting the following message when accessing the TextEvent
link:

*** Security Sandbox Violation ***
Connection to TextEvent:Safing Sensor halted - not permitted from
app:/StoryboardPlayer.swf
-- This is due to the value of 'allowNetworking'.

the strange thing is, it worked fine @ home last night but today @ work I get
the message. My thinking is, it's the network since the development machine is
not authenticated to the network (its my personal laptop). I get the message as
soon as I click on the link 'cause the trace() in the listener doesn't fire.
Any thoughts?

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 10:21 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Inactive Reminders By Mished.co.uk