Copy link to clipboard
Copied
Hi,
How should i code a onclick event to activate something on the timeline?
So basiclly when the user clicks something, i want the time line to play what i have put in there
Any info would be great thanks
Copy link to clipboard
Copied
something.addEventListener(MouseEvent.CLICK, activateSomething);
function activateSomething(evt:MouseEvent):void {
// whatever you mean by play what you have put in the timeline
}
where "Something" is the instance name of the thing you click
Copy link to clipboard
Copied
Is there a way to put in an action on the start of the time to say, dont start this till the user clicks this?
Copy link to clipboard
Copied
That is what that code does.
Copy link to clipboard
Copied
It didnt work, i must be doing something wrong, the timeline still plays even when i put the code in.......my timeline is 48 frames long and its a motion tween and i have created a second lay to put the code in because i cant put it in the layer with the motion in it.
All i have is a block which scrinks, called Bcard and i just want it to shrink when the user clicks on it. I put your code into the second layer action but the motion still play before the user clicks it......
Copy link to clipboard
Copied
Have you tried putting a stop(); command in the timeline to keep it from moving?
Copy link to clipboard
Copied
Yea i did....But the clip stops and when i click on the instance it doesnt play the timeline/
Copy link to clipboard
Copied
Up to this point you haven't shown any code at all. Show what code you are using and maybe someone can help.
Copy link to clipboard
Copied
This is the first time i am implementing coding into the action.
I will try and explain it abit better.
I have a image which is a card, i turned it into a motion tween and in the 24 frames all it does is shrinks in size but i do not want it to shrink untill the user clicks on the card. Thats all i am trying to do.
Thank you
Copy link to clipboard
Copied
Up to this point you haven't shown any code at all. Show what code you are using and maybe someone can help.