If I understand the locations of your dynamic clips correctly, then 

_root[sSelected]._mc.hresizer.setSize...

should work.  Basically, access the dynamic clip by treating _root as an
associative array.  If the clips aren't created in _root, then substitute
the parent movie clip's name for "_root" above.

-Chris

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Bo Parker
Sent: Wednesday, October 26, 2005 11:13 AM
To: Flashcoders mailing list
Subject: [Flashcoders] Addressing dynamically named movie clip

I am working on an application where I want to apply transformations
to dynamically named movie clips. I have a function which adds a
shape to the stage based on a linkage name in the library:

function addShape(sLinkage:String):Void {
     var nIndex:Number = _root.getNextHighestDepth();
     var mcShape:MovieClip = this.attachMovie (sLinkage, "mcShape" +
nTopDepth, nTopDepth);
     nTopDepth = nIndex;
     mcShape._x = 450;
     mcShape._y = 300;
     }

from a button on the root level of the stage I call the function:

squareButton.onRelease = function() {
     addShape("rectangle");
};

I then want to be able to apply transformations to the new movie clip
using the bitstream component slider that is within a movie clip at
_root.squareBar:
///////////squarebar
squareBar.hs.changeHandler = function(){
     _root.rectangle_mc.hresizer.setSize(squareBar.hs.value,
squareBar.vs.value);
}
squareBar.vs.changeHandler = function(){
     _root.rectangle_mc.hresizer.setSize(squareBar.hs.value,
squareBar.vs.value);
}

I originally had a static movie clip called "rectangle" that was on
the root level but have since replaced with the dynamically named
movie clips.

I have a variable defined on frame 1 of the root level called:
var sSelected:String;

Within the rectangle movie clip that gets added to the stage, upon
pressing the movie the sSelected variable is set to the instance name
of the rectangle selected:
on (press) {
     sSelected = this._name;
     trace(sSelected);
}

The sSelected variable is showing up fine by my problem is how do I
address sSelected or the dynamic instance name of the movie placed on
stage to apply the transformations from the squareBar.hs.changeHander
function?

i.e. squareBar.hs.changeHandler = function () {
     [dynamically named movie clip here]._mc.hresizer.setSize...
}

Thanks in advance for the help.
Sincerely,
Bo Parker
-- 

Bo Parker, AIGA
RMC
215 S Jennings Avenue
Fort Worth, TX  76104
817.332.4700 p
817.332.4710 f

www.rmcfw.com

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to