This content has been marked as final. Show 3 replies
dispatching the event and setting the "prog" var to the % in which i want my meter to display
//heres the flex side
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx=" http://www.adobe.com/2006/mxml" horizontalScrollPolicy="off" verticalScrollPolicy="off" backgroundColor="#000000" width="100%" height="100%">
public function populate(mySize:Number):void
prog=mySize * 10;
dispatchEvent(new Event("setMeter", true));
<mx:SWFLoader source="meter.swf" width="100%" height="100%" id="mtr1"/>
what im doing here is adding an event listener from my embedded swf (4 parents deep).
then setting a var(myFlex:Object) to the movieclip.parent.parent.parent which would be the flex movieclip
then actually grabbing that var "prog" to figure out what level to set the meter.
//heres the flash side
var mm:MovieClip = this;
var myFlex:Object = mm.parent.parent.parent;
i know there are definitely better ways to do this but it works for me. i have used the external interface class and local connection class but this works pretty well for me too if the vars you need aren't too ambiguous. im currently using the external interface with the yahoo maps api and it works really well but im having trouble using more than one external interface instance in the same app....so i went this route for some of the newer simpler ones .
basically what we are doing is storing a string of text on the flex side, and then sending it to the flash side to display. That's it in it's simplistic form.
How are the Flex app and the flash swf related? ie, what is the component architecture.