Yesterday I was building a WindowManager class, and I wanted to assign
random names to each created window. So I went for the obvious:

var randName:String = String(Math.round( Math.random() * 1000000 ));
var _newWin:Window = Window( _tgt.attachMovie(_linkage, "newWin_" +
randName, _tgt.getNextHighestDepth(), initObj) );

which gives me something like: _level0.windowContainer.newWin_123456

however, when I tried to load an external image into a movieclip
inside this new Window, MovieClipLoader.loadClip() failed silently,
and loadMovie() gives an error in the path (doesn't specify which
path, but then I found it was the destination movie's path)
setting properties like _newWin.textContainer.text = 'xyz'; works ok,
but I could not load an image into _newWin.imageContainer, even though
I can trace it (gives me
_level0.windowContainer.newWin_123456.imageContainer)

then I did this, and the image loaded correctly, along with the text properties:

var randName:String = String(Math.round( Math.random() * 1000000 ));
var randNameArray:Array = randName.split( '' );
var newNameArray:Array = new Array( randNameArray.length );
for ( var i:Number = 0; i < randNameArray.length; ++i ) {
        newNameArray[i] = String.fromCharCode( 97 + Number(randNameArray[i]) );
}
randName = newNameArray.join( '' );
var _newWin:Window = Window( _tgt.attachMovie(_linkage, "newWin_" +
randName, _tgt.getNextHighestDepth(), initObj) );

basically I converted the numbers into their letter equivalent,
starting from a, which gives me something like:
_level0.windowContainer.newWin_abcdef

and now both loadMovie() and MovieClipLoader.loadClip() loads the
image correctly

my question is, why is this happening? isn't a digit a valid
'variable-letter' in flash ?
is this a known issue, or is it just me? am I doing something wrong?
_______________________________________________
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

Reply via email to