If I create a clip or text field like this: max_amt = 10 for(i=0; i<=max_amt; i++){ createEmptyMovieClip("clip"+i,i); clipi.createTextField("text"+i,i+max_amt, i, i*2,100,20); } how do I access clip0._x or clip5's value with i's? a cheesy example how do I assign the first clip's (clip0) _x to the value of the last clip then increment...
something like - max_amt = 10 for(var ii=0; ii<=max_amt; ii++){ rClip = createEmptyMovieClip("clip"+ii,ii); rClip.createTextField("text"+ii,ii+max_amt,0,0,100,20); tClip = rClip["text"+ii]; tClip.text = ii; tClip._y = ii*30; } hth
Jack, Thanks for the help.
passing arrays through a function is probably the most efficient, create your array in your loop and pass it, or hardcode as in this example - aTxt1=["q","w","e","r","t"]; aTxt2=["a","s","d","f","g"]; function fields(arr){ max_amt = 4; for(var ii=0; ii<=max_amt; ii++){ rClip = createEmptyMovieClip("clip"+ii,ii); rClip.createTextField("text"+ii,ii+max_amt,0,0,100,20); tClip = rClip["text"+ii]; tClip.text = arr[ ii ]; tClip._y = ii*30; } }; fields(aTxt1); btn.onPress = function(){ fields(aTxt2); } hth
I want to add a button to each of the clips so that they'll go to a location, but it's not working. Here's what I got: aTxt1=["q","w","e","r","t"]; aTxt2=["a","s","d","f","g"]; function fields(arr){ max_amt = 4; for(var ii=0; ii<=max_amt; ii++){ rClip = createEmptyMovieClip("clip"+ii,ii); rClip.createTextField("text"+ii,ii+max_amt,i,i*100,100,20); tClip = rClip["text"+ii]; tClip._y = ii*30; tClip.text = arr[ ii ]; rclip.onPress = function(){ getURL("http://www."+aTxt1[ii],"_blank") //getURL("http://www."+aTxt1[3],"_blank") // works, but is wierd... fields(aTxt2); } } }; fields(aTxt1); Any way to press functions for each in the main function?
try - aTxt1=["q","w","e","r","t"]; aTxt2=["a","s","d","f","g"]; function fields(arr){ max_amt = 4; for(var ii=0; ii<=max_amt; ii++){ rClip = createEmptyMovieClip("clip"+ii,ii); rClip.createTextField("text"+ii,ii+max_amt,i,i*100,100,20); tClip = rClip["text"+ii]; tClip._y = ii*30; tClip.text = arr[ ii ]; rClip.onPress = function(){ temp = this._name.split("clip"); openWindow(temp[1]); }; } }; fields(aTxt1); function openWindow(num){ getURL("http://www."+aTxt1,"_blank"); }; hth
that should be - function openWindow(num){ getURL("http://www."+aTxt1[ num ],"_blank"); }; why does this forum post screw up on
Thanks Jack, That's great, I changed the getURL to _self and in while in flash it was opening the link 3 times, but when I changed it to _blank it only opened it once. Ever seen that happen before?
_self is the default action of getURL, so should not be needed, old pros - (Byron Canfield comes to mind) recommended that it should NEVER be used as it is unstable. hth ps .. for correct results, always test getURL in the browser.
Cool. I'll keep that in mind. Thanks.
Don't see what you're looking for? Try a search.
|