This is baffling me. I have a .swf that lets the user color select a uniform, choose a color, and drop the color on a part of the uniform. It works fine in _level0 but won't work in another level. It's NOT a simple path issue, because what seems to be happening is that Flash drops the LAST part of the target path when not in _Level0.

Here's the relevant code:

//
// get the piece of the uniform to be colored:
lastSlash=this._droptarget.lastIndexOf("/"); // correctly returns "a" "b" or "c"
//
// now, construct the full path to that piece:
var myTarget="_root.uniforms.u."+this._droptarget.substring(lastSlash+1);
//
// color the uniform dropTarget using the color that was chosen (_global.rgb):
targetColor=new Color(myTarget);
targetColor.setRGB("0x"+_global.rgb);
//

Now here's what I find strange:
When testing this playing in _level0, I can get this correct trace:
trace(myTarget); // returns "_root.uniforms.u.a"

But if I test from another movie that loads this swf into another level, I get this trace:
trace(myTarget); // returns "_root.uniforms.u"

Notice it drops the last element of the target, so the parent gets colored by mistake.

I can't figure out why the target would parse differently inside different levels, but for the purposes of this application I do need to run the swf in a level other than _level0.

TIA,
Marc


_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to