Groups | Blog | Home
all groups > flash actionscript > february 2006 >

flash actionscript : Dynamicly added onPress, to looped createMC's


TheRealTwiner
2/2/2006 7:55:04 PM
let me give you a description of the situation
I'm building a dynamicly created picture gallery
the gallery loads in a list of pictures, and appends it into an array, grabs
the array to create empty movie clips and then adds location information to them
What I want to do is in the loop I want to add an "onPress" event for Each
clip I creat in the loop
in psuedo code it would look something like this

Do{

createmovieclip("thumb_"+counter, ontop)
.move(a location)

///////////////////////////////////////////////////////////////////////////
.add(onPress) { getURL("theaccessurl") }
///////////////////////////////////////////////////////////////////////////

}While( x <= y);

If you understand what I'm trying to depict here
I want to add an onpress event to EACH thumbnail I create, that links to its
fullsize version.

If anyone can give me an explanation on how to do this that would be great!
zensoldier
2/2/2006 9:32:55 PM
In the loop you attach your clips with just add

this.onRelease = function()
{
//Stuff you want to do
}

TheRealTwiner
2/2/2006 10:21:44 PM
Thanks for the help, but it didn't work. maybe there is a reason?

_root.onRelease = function()
{
getURL("http://www.3dstratum.com/twiner/"+Path+imgs_array, _blank)
zensoldier
2/3/2006 6:53:56 PM
this

not _root


TheRealTwiner
2/3/2006 7:58:24 PM
That still didn't rememedy the problem unfortuanetly.
the entire thing is running inside a loop to generate a "grid" of photos
similar to below

do
{
MakeClip(newName)
MoveClip(newName)
loadMovie(picture, newName)
}
while
TheRealTwiner
2/3/2006 8:57:46 PM
AddThis Social Bookmark Button