Skip to main content
Inspiring
March 28, 2013
Answered

Can you use actionscript to detect if an icon has been clicked in your Flash Website?

  • March 28, 2013
  • 1 reply
  • 1971 views

I want to make my icons glow, or pulsate, if they have not been clicked.  If the viewer clicks on the icon, they will watch a video clip, and then be sent back to the main screen with the pulsating icons.  Is it possible for Flash to detect if that icon has been clicked when returning to the main screen so the icon they clicked can stop pulsating?

?  I am certain it is not possible with the timeline.  Any help would be appreciated as always

This topic has been closed for replies.
Correct answer kglad

I should rephrase this I suppose.  I know how to do mouse over and click events.  I know how to animate movie clip buttons.  Let me try to explain this better since I screwed it up the first time pretty badly. 

Say the main area is in frame one.  This includes all the movie clip buttons (say 4 of them).  On frames 2-5, there are brief videos that play through an FLV player.  On the initial visit to Frame 1, the user clicks on one of the buttons to take them to, say, frame 3.  Once the movie completes, the user is then put back to frame 1 again.  Is it then possible to have the frame 3 button no longer glow or pulsate, but still work as a button?  I want my user to know where they have already been on my site, and I am not sure this is possible


that setup is problematic.  use a one frame swf that contains your icon movieclips, only.  assign the icon movieclips instance names like icon1_mc, icon2_mc etc.  add an flvplayback component to your library.

you can then use:

var flv_pb:FLVPlayBack=new FLVPlayBack();

flv_pb.addEventListener(Event.COMPLETE,completeF);

function completeF(e:Event):void{

removeChild(flv_pb);

}

var gf:GlowFilter=new GlowFilter();

var previouslyClickedIcon:MovieClip;

var iconA:Array=[icon1_mc, icon2_mc, etc..];

var flvA:Array=["flv associated with icon1.flv", "icon2.flv", etc..];

for(var i:int=0;i<iconA.length;i++){

iconA.addEventListener(MouseEvent.CLICK,clickF);

}

function clickF(e:MouseEvent):void{

if(previouslyClickedIcon){

previouselyClickedIcon.filters=[];

}

MovieClip(e.currentTarget).filters=[gf];

addChild(flv_pb);

//position flv_pb

flv_pb.source = flvA[iconA.indexOf(e.currentTarget)];

}

1 reply

kglad
Community Expert
Community Expert
March 28, 2013

what's the relationship between your swf and the icons?

are the icons in the swf?  are the icons outside the swf but in the same html page as the swf?

EverestJAuthor
Inspiring
March 28, 2013

The icons are essentially buttons that move to another frame and play a video.  They are all in the same exported swf

kglad
Community Expert
Community Expert
March 28, 2013

convert your icons to movieclips, add mouse listeners and apply a glow filter (animate the filter if you want it to pulsate) to a clicked icon and unapply the filter to the previously clicked icon movieclip (if there is one) in your listener function.