---- Original Message ----

> From: Henrik Andersson <he...@henke37.cjb.net>
> To: Flash Coders List <flashcoders@chattyfig.figleaf.com>
> Sent: Mon, July 26, 2010 12:06:55 PM
> Subject: Re: [Flashcoders] (no subject)
> 
> John Singleton wrote:
> >          function  RotateGearsLoaded(e:Event):void
> Why is that? I tried to pass that var like  this:
> >
> >  
>loader.contentLoaderInfo.addEventListener(Event.COMPLETE,RotateGearsLoaded(displayGearsCounter));
>
> >
> 
> RotateGearsLoaded  returns void, not Function. The return value is not a 
> legal listener. Yet  you are calling it here to get the listener to add.
> 
> Remember, you are not  the one calling the listener, thusly, you can't 
> decide the  arguments.

That makes sense. Unfortunately, it's not clear to me how I should proceed. 
Could you either recommend a tutorial or give an example?
TIA,
John
PS. Original code for those who skipped this message because it had no subject:

        function Main()
        {
            InitRotateGears();
        }
        
        function InitRotateGears()
        {
            for (var i = 0; i < gearsPaths.length; i++)
            {
                RotateGears();
                displayGearsCounter += 1;
            }

        function RotateGears()
        {
            var path:String = new String();
            path = gearsPaths[displayGearsCounter];
            var req:URLRequest = new URLRequest(path);
            var loader:Loader = new Loader();
            loader.load(req);
            
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,RotateGearsLoaded);
        }

        function RotateGearsLoaded(e:Event):void
        {
            var loaderInfo:LoaderInfo = e.target as LoaderInfo;
            var displayObject:DisplayObject = loaderInfo.content;
            displayObject.width = gearWidths[displayGearsCounter];
            displayObject.height = gearHeights[displayGearsCounter];
//            displayObject.x = - gearWidths[displayGearsCounter];
//            displayObject.y = - gearWidths[displayGearsCounter];
            displayObject.x = 0;
            displayObject.y = 0;
            trace(displayGearsCounter);
            parent_container.addChild(displayObject);
            parent_container.x = 0;
            parent_container.y = 0;
            parent_container.alpha = 1;
            addChild(parent_container);
            var myTimeline:TimelineLite = new TimelineLite({useFrames:true});
            myTimeline.append(new TweenMax(parent_container, 1, 
{shortRotation:{rotation:gearAngles[displayGearsCounter]}}));
            }
        }


      

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to