Friday, March 26, 2010

focusrect problem for dynamic movieclip

Hi all,

I am not able to focus the movie clip event the focusrect set to true

Here I am placing the code below

can point out where i went wrong

thanks in advance

/////////////////////////////////////////////////////////

Code

////////////////////////////////////////////////////////

function createGallery():Void

{

for(var i:Number=0; i%26lt;NO_OF_IMAGES;i++)

?{

var pImage:MovieClip =?tLevel.createEmptyMovieClip(''pImage''+i,tLevel.getNextHighestDepth());

pImage.onLoad = function ()

?{

pImage._focusrect=true;

}

?pImage.onRelease = function ()

{

trace(''pImage onRelease called'');

?}

imgCollection.push(pImage);?// inserting the reference into an array for further access

?} // end of for loop

_loadImageRef=setInterval(loadImages, 500);

}

function loadImages():Void {

if(imagesLoaded%26lt; NO_OF_IMAGES)

{

imgCollection[imagesLoaded].loadMovie(''image URL'');?// loading the image into the movie clip

imagesLoaded++;

?}

else

{

clearInterval(_loadImageRef);

?}

}

focusrect problem for dynamic movieclip

what are you trying to do?

focusrect problem for dynamic movieclip

i want to create a dynamic gallery which scroll the images for flash lite 3.0 with ActionScript 2

I am not able to focus the images

you want to allow users to set focus on the images or you're trying to set focus without user interaction?

I want to allow users to set focus

use:

function createGallery():Void

{

for(var i:Number=0; i%26lt;NO_OF_IMAGES;i++)

?{

var pImage:MovieClip =?tLevel.createEmptyMovieClip(''pImage''+i,tLevel.getNextHighestDepth());

pImage.createEmptyMovieClip(''targetMC'',1);

?pImage.onRelease = function ()

{

trace(''pImage onRelease called'');

?}

imgCollection.push(pImage);?// inserting the reference into an array for further access

?} // end of for loop

_loadImageRef=setInterval(loadImages, 500);

}

function loadImages():Void {

if(imagesLoaded%26lt; NO_OF_IMAGES)

{

imgCollection[imagesLoaded].targetMC.loadMovie(''image URL'');?// loading the image into the movie clip

imagesLoaded++;

?}

else

{

clearInterval(_loadImageRef);

?}

}

I am not able to load the images

show the code you used.

Sorry for the previous reply

I made a little mistake while copying

yes I am able to load the images

here you are creating one more movie clip in pImage and loading the images in it, am I right?

thanks for your help

yes.

when a movieclip is used as a load target its mouse handlers (among other things) are reset.?so, you must either wait until loading is complete to assign those mouse handlers or, assign the handlers to a parent movieclip and load into a child target movieclip.?i did the latter.

How I can know which object is focused ?

I registered an listener to the pImage so that when the user click on the image i would like to display the movie clip name

I tried with the onSetFocus it is giving the previous focused object not the current, how to get the current focus object

pImage.onRelease = onSetFocusFunction;


function onSetFocusFunction(oldFocus) {

?trace(''onSetFocus called, previous focus was: ''+oldFocus);

}

assign whatever property you want to retrieve in your loop when you create pImage.

i am assigning the name to movieclip

but i am able to get the previous focus , how i can get the present focus movie clip

show your code.

No comments:

Post a Comment