Kind of stumped here.
I have a class that holds an instance of a toolbar class.
The toolbar class has a method "addTool" that takes a linkage
identifier, attaches a movieclip with it and returns a reference to the
created movieclip as such:
inventoryTool = toolArea.addTool("InventoryToolMC");
toolArea.addTool looks like this:
function addTool(primary:Boolean,identifier:String):Object{ var d =
primary_tools.getNextHighestDepth();
var tool:Object = primary_tools.attachMovie(identifier,identifier+d,d);
this.addListener(tool);
tool.addListener(this);
primaryTools.push(tool);
updateTools(1);
return tool;
}
However, this is giving me a whole heap of trouble.
In the case of:
inventoryTool = toolArea.addTool("InventoryToolMC");
inventoryTool is a class variable, and always comes up undefined.
I can do this:
trace(toolArea.addTool("InventoryToolMC"))
inventoryTool = toolArea.addTool("InventoryToolMC");
trace(inventoryTool);
And the first trace will show a movieclip path and the second undefined.
If i do
var inventoryTool:Object = toolArea.addTool("InventoryToolMC");
trace(inventoryTool);
it works fantastically.
So what gives? I can only access a reference to the returned tool clip
in a local var and not a class var? What could cause this? I look at my
script and i've done things like it a thousand times over, and i've
never seen anything like this.
Here's hoping i'm merely stupid.
- Andreas
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com