Your dictionary is built off of that goto attribute but then you're passing in an instance of the object into the dictionary array.
You have not assigned a name property to your assets. So when defining them you might also set the .name property to the @goto attribute. e.target as String will return undefined if you don't manually assign a name string. (A Sprite does not know the name of the instance variable that was used to store it). Haven't read all of your code but you might also consider trace(dict[e.target.no...@goto]); but you'll probably have to do some casting. -jonathan On Thu, Sep 3, 2009 at 1:19 PM, thomas horner<tho...@megawattmedia.co.uk> wrote: > ok i'm creating a dictionary to store the values contained by some sprites > that im using as button but i keep getting term undefined when i click on > the item in the output. > > > > > > //create dictionary to store data > > public var dict:Dictionary = new Dictionary(); > > > > for (var Wi:int=0; Wi < len; Wi++) { > > if > (assetArray[Wi] is IBitmapSprite) { > > > trace(assetArray[Wi]); > > > var myBitmap=IBitmapSprite(assetArray[Wi]).container; > > > IBitmapSprite(assetArray[Wi]).content.visible=true; > > > > > //assign data to dictionary item > > > dict[(assetArray[Wi]).no...@goto] > > > > > > > > myBitmap.visible=true; > > > myBitmap.x=xPos; > > > myBitmap.y=0; > > > > > > > > > > > xPos=xPos+myBitmap.width+padding; > > > myBitmap.alpha=1; > > > trace(myBitmap.x); > > > trace(myBitmap.width); > > > // new stuff > > > myBitmap.buttonMode=true; > > > myBitmap.addEventListener(MouseEvent.CLICK, bitmapClick); > > > scroller.holder.addChild(myBitmap); > > } > > > > function bitmapClick(e:Event) { > > > > > > trace(dict[e.target]); > > > > > > } > > _______________________________________________ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > -- -jonathan howe _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders