I'm trying to load a flash 9 SWF into Flex with some luck.  I can 
get it in there with SWFLoader but now how can I use something from 
the Flash Library… or can I?

I get this error when I run the code below "ReferenceError: Error 
#1065: Variable Radar is not defined."  But when I "Dismiss All" 
then click the button in the app it will move the radar movieClip 
that sits on the Flash Stage.  I'm confused as to what this error is.

For the library item - If it was being done in Flash, I'd use  
attachMovie () like: 

var cPoint:MovieClip = circle.attachMovie(pointer, 'point' + 
counter, 0 + counter, {_x:centerX + x, _y:centerY + y, date:cDate});

which would place the item on the stage as many times as I need it 
depending on the number of nodes from my XML.  Is there a way to do 
this in Flex using my loaded SWF?

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; 
layout="absolute" creationComplete="init(event)">
<mx:Script>
        <![CDATA[
                import flash.events.*;
                import flash.net.URLRequest;
                import mx.controls.SWFLoader;
                import mx.utils.ObjectUtil;
                [Bindable]
                private var loaded:Boolean = false;
                private var swfContent:MovieClip;
                private var myLoader:SWFLoader = new SWFLoader();
                
                private function init(e:Event):void{
            myLoader.showBusyCursor = true;
            myLoader.addEventListener
(Event.INIT,loadHandler);        
            this.addChild(myLoader);
            myLoader.y = 25;
            myLoader.x = 25;
            myLoader.load("Flash/radarFlexNoScript.swf"); 
        }
                private function loadHandler(e:Event):void{
            loaded = true;
            swfContent = e.target.content;  
        }

                private function setRadar ():void {
                        //swfContent.getChildByName('radar').x = 0;
                        swfContent.radar.y += 20;
                        //swfContent.addChild('myPoint');
                }
                
                
        ]]>
</mx:Script>
<mx:Button click="setRadar()" label="Set Something" />
</mx:Application>


Reply via email to