Hi I am trying to understnd some of the things about packages, I have expand a book exercise and I am now trying to workout how to reference a return value within this package.
I have put together this package
What I am trying to do is use the 'return(spot1);' value where 'new smiley1(); is.Code:package classes { import flash.display.*; import flash.utils.getDefinitionByName; public class SmileySwitch { private static function get SmileySwitch1() { var s1:String = gotSpot("smiley" + 8); function gotSpot(s1:String):MovieClip { var spot1a:Class = Class(getDefinitionByName(s1)); var spot1:MovieClip = new spot1a(); return(spot1); } } public static function get getSmileySwitch1 { var spot1 = new smiley1(); return(spot1); } } }
My goal is to be able to create the library object name, (in this case smiley1 from a string variable and then display it on the stage with addChild. At this stage I am just trying to work out how to swap 'new smiley1' with the 'return' value.
I will work on the addChild bit next, but happy to take any tips on that too.
Thanks in advance for you help.![]()




Reply With Quote