![]() |
![]() |
||||||
|
|||||||
| Tags: asfunction, equivalent, 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? |
| Sponsored Links |
|
|||
|
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? |
|
|||
|
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) |
|
|||
|
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. |
|
|||
|
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 |
|
|||
|
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? |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
- Contact Us
-|-
Adobe Dreamweaver Forums -|-
Archive -|-
Top -|-Rules/Disclaimer-|-Help/Support-|-Advertise