Re: [Flashcoders] references as return value issues

2006-08-30 Thread Andreas Rønning
Yeah, but nm that :) Forgetfulness on my part when typing in this 
example. Trust me that's not the issue. The actual addTool function has 
a twotiered conditional that just dictates what clip the new tool be 
attached to, thought i'd spare you that excess script.


- A

Ian Thomas wrote:

Um - on a really swift look - shouldn't the first parameter be a boolean?

i.e.
inventoryTool = toolArea.addTool(false, "InventoryToolMC");

On 8/30/06, Andreas Rønning <[EMAIL PROTECTED]> wrote:


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
___
[email protected]
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


___
[email protected]
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


--

- Andreas Rønning

---
Flash guy
Rayon Visual Concepts, Oslo, Norway
---
___
[email protected]
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


Re: [Flashcoders] references as return value issues

2006-08-30 Thread Ian Thomas

Um - on a really swift look - shouldn't the first parameter be a boolean?

i.e.
inventoryTool = toolArea.addTool(false, "InventoryToolMC");

On 8/30/06, Andreas Rønning <[EMAIL PROTECTED]> wrote:

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
___
[email protected]
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


___
[email protected]
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