dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Name property of loader object lost in CLICK event.

  1. #1
    ReMember gobbles's Avatar
    Join Date
    Nov 2002
    Location
    Denmark
    Posts
    983

    Name property of loader object lost in CLICK event.

    PHP Code:
    private function loadIcons():void{
                
    count 0;
                
    iconArray = new Array();
                for(var 
    i:uint 0menuArray.lengthi++){
                    
    loader = new Loader();
                    
    loader.contentLoaderInfo.addEventListener(Event.INITplaceIcons);
                    
    loader.load(new URLRequest("assets/icons/" menuArray[i] + "_icon.swf"));
                }
            }
            
            private function 
    placeIcons(event:Event):void{
                
    iconArray[count] = (loader.content as MovieClip);
                var 
    loadedContent:MovieClip = (loader.content as MovieClip);
                
    //loadedContent.play(); needed for later to play ani.
                
    iconArray[count] = loadedContent;
                
    iconArray[count].addEventListener(MouseEvent.MOUSE_DOWNmenuSelected);
                
    addChild(iconArray[count]);
                
    count++;
            }
            
            private function 
    menuSelected(event:Event):void{
                
    //addChild(loader);
                
    trace(event.target.name);  //PROBLEM GETTING THE INSTANCE NAME OF THE BUTTON PRESSED!!!! Look into
            

    Well, hard title.. sorry.

    the object is to load a couple of swf's which serves as icons in a menu. I place these in an array so I can reference them later, then when clicked I need to know the id, name or anything about that swf to load the appropriate page which goes with the icon swf.

    The problem is that even after I make the coercion to MovieClip on the "loadedContent" I am not allowed to set the "loadedContent.name = "instance name"" and no matter what I try all I get in the menuSelected function is "instance27" or what ever the player calls it at runtime..

    I am quite sure I did this a thousand times, but now it does not work?

    Thanks for any help given
    http://www.rickigregersen.com ...finally a blog!

    Your damned if you do...but your particually damned if you don´t

  2. #2
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Change loader.content to event.currentTarget.content
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

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