A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: MovieClip and Loader difficulties...

Hybrid View

  1. #1
    Senior Member
    Join Date
    May 2009
    Posts
    280

    MovieClip and Loader difficulties...

    Basically what im doing is making a whole bunch of movieclips using a loop and loading an image into them..The movieclip is a success, but no object is there or seen on stage...


    PHP Code:
    private function createProjects():void
            
    {
                for (var 
    i:int 0numberOfProjectsi++)
                {
                    var 
    movieclip:MovieClip = new MovieClip(); //Creates the movieclip
                    
    movieclip.name "card" i//Gives a name card + the current project number
                    
    movieclip.addEventListener(MouseEvent.CLICKdisplayDataF); //Adds an event listener
                    
    movieclip.addEventListener(Event.ADDED_TO_STAGEaddedToStageF);
                    
    container.addChild(movieclip); //Adds the movieclip to a movieclip already on stage
                
    }
                
            }
            
            private function 
    addedToStageF(e:Event):void 
            
    {
                
    removeEventListener(Event.ADDED_TO_STAGEaddedToStageF);
                
                
    e.target.randomF(01200); //randomF is a function used to create a random number givin a low and high val.
                
    e.target.randomF(0800);
                
                var 
    l:Loader = new Loader(); //Creates loader
                
    var urlreq:URLRequest = new URLRequest("beach.jpg"); //Uses defult image for now
                
    l.load(urlreq); //Loads
                
    e.target.addChild(l);
                
                
    trace("x = " e.target." y = " e.target.y);
            } 

  2. #2
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    I'm surprised this isn't throwing an error - you're calling addChild on the event target which is an Object - it ought to be a DisplayObjectContainer or some subclass.

    Still - I'm not sure that's the problem. Add some listeners to the loaders for IOErrorEvents and COMPLETE events - that should tell you if things are getting in and not showing, or if the loaders are breaking.
    Please use [php] or [code] tags, and mark your threads resolved 8)

  3. #3
    Senior Member
    Join Date
    May 2009
    Posts
    280
    What are you talking about DisplayObjectContainer? Am I formatting it wrong?

    And I've done what you have said before. Its defenitly the addChild because the loader is loading and everything.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center