Clip Event
ok this is a dumb question, but how exactly do you use clip event enterframe?
when i put a mc in a frame with a stop command on it, does the mc still enterframe continuosly? or does it enterframe once? what other tricks are there with using enterframe?
FlashKit > Flash Help > Flash ActionScript
Posted on: 12-30-2001, 03:28 AM
View Complete Forum Thread with Replies
Sponsored Links:
OnRelease Event Does Nothing For Clip Inside Clip
I have a "menu" movie clip. Inside that is an instance of another "button" movie clip named "myButton". The menu clip is exported for actionscript. In my main timeline I have an empty clip with the instance name of "empty". The code is:
_root.empty.attachMovie("menu", "myMenu", 1);
//menu clip is attached
_root.empty.myMenu.myButton.onRelease = function () {
trace("this never shows");
}
why does the onRelease event not do anything? If i put this code directly on the myButton instance inside the menu clip I don't see the trace either. However, the following code DOES work:
_root.empty.attachMovie("menu", "myMenu", 1);
//menu clip is attached
_root.empty.myMenu.onRelease = function () {
trace("this shows");
}
but i need the code to execute when the button inside the menu is clicked not the whole menu itself. Any help is appreciated!
View Replies !
View Related
On Clip Event
simple question. I am trying to put an on clip event on a movie clip, but the option is grayed out in the actionscript window. Any ideas why and what is the way to do it? I want to be able to click on the movie clip and jump to another frame.
Thanks a lot.
View Replies !
View Related
Clip Event
Hello, I am doing a drag and drop and here is my code:
onClipEvent (enterFrame)
if (this.hitTest(_root.two)==true
_parent.right=_parent.right+1
Basically if the droptarget for the movie is true then increment the variable right by 1. The problem is that once it is equal to true, the variable keeps increasing by 1. It's almost like a counter and it keeps going. How do I get it to just increment it by 1 and then stop?
Thanks
View Replies !
View Related
On Clip Event?
i'm creating a drop down menu using the code in this tutorial.
http://www.flashkit.com/tutorials/In...-951/index.php
except i cant get it to work.
firstly: it will not play the menu movie clip to reveal the menu items. ( i know i havent got the correct paths for the dynamic text box yet)
secondly: it works differently if i take out the follow curser MC. (but still not right)
please help as i'm not clued up with the onclip event code.
rat
View Replies !
View Related
On Clip Event, Is There Another Way?
onClipEvent (load) {
num = 3;
}
on (release) {
if (_root.link<>num and _root.animation == 1) {
_root.animation = 0;
_root.link_prev = _root.link;
_parent["item"+_root.link].gotoAndPlay("s2");
_root.link = num;
_root.play();
_root.scroller.scroller.gotoAndStop(3);
_root.category_num = 4;
_root.pic_category_num = 46;
}
}
All I want to do is, on release go to page number "X" instead of the number listed in the "onclip event". It won't let me because of **Error** Symbol=shortcut buttons, layer=Layer 1, frame=1:Line 21: Clip events are permitted only for movie clip instances
}onClipEvent (load) {
Can anyone help??
View Replies !
View Related
On Clip Event
Hello!
I have a question about priority, If I put "onClipEvent (mouseUp)" and then for example there's a button on the stage with on (release) blah blah,wich script will run first or both of them ... The problem is that i made drop down menu and there's on clip event so that the menu rolls back when the mouse is clicked anywhere on the screen , but the problem is that the submenu buttons wont work if i put on mouse event on one of those buttons....
View Replies !
View Related
On Clip Event?
I have these animated menus that kick in when you roll over them. See www.stephanieerdel.com/headermov.swf . The only problem is that I don't know the command to turn the movies off when you roll off them. If I do a rollOut event handler on the child button, it stops the movie before it's done playing.
I basically want it to play the movie while your mouse is over the link and the sublinks but when you roll off the sublinks or the main link then the movie stops playing. Is this an OnClipEvent? If so, then what is the command? And what level do I write the actionscript on?
View Replies !
View Related
On Clip Event
Hi
What is the right action script for this on clip event to put it in its own layer in the timeline?
onClipEvent (load) {
_x = 22;
_y =113;
div = 5;
}
onClipEvent (enterFrame) {
_x += (endX-_x)/div;
_y += (endY-_y)/div;
_root.pic1.onRelease = function() {
endX = 22;
endY = 113;
};
_root.pic2.onRelease = function() {
endX = -282;
endY = 113;
};
_root.pic3.onRelease = function() {
endX = -582 ;
endY = 113;
};
}
Thanks in Advanced
Attach Code
onClipEvent (load) {
_x = 22;
_y =113;
div = 5;
}
onClipEvent (enterFrame) {
_x += (endX-_x)/div;
_y += (endY-_y)/div;
_root.pic1.onRelease = function() {
endX = 22;
endY = 113;
};
_root.pic2.onRelease = function() {
endX = -282;
endY = 113;
};
_root.pic3.onRelease = function() {
endX = -582 ;
endY = 113;
};
}
View Replies !
View Related
Getting Out Of A Clip Event
I have this programme with I put together from a few tutorials and bits and pieces. It does a simple dot to dot game.
I have it all working -except when you have clicked around all the dots and back to the start I cannot get it to go to the congratulations scene.
Any ideas - .fla attached
View Replies !
View Related
Getting Out Of A Clip Event
I have this programme with I put together from a few tutorials and bits and pieces. It does a simple dot to dot game.
I have it all working -except when you have clicked around all the dots and back to the start I cannot get it to go to the congratulations scene.
Any ideas - .fla attached
View Replies !
View Related
On Clip Event Problem
Hi all,
I have a movie, parentmovie, and inside it is a movie clip called my text clip and a movie clip called biplane. Both have been given instance names of the same. In my text clip I have:
onClipEvent(mouseMove){
startDrag("biplane", true);
}
but I get the error clip events are permitted only for movie clipinstances....
I expected that when the mouse moved over the text clip movie that the plane would start to drag....????
Has anyone any ideas I think I'm misunderstanding the OnClipEvent command....
regards, kieran
View Replies !
View Related
Clip Event Problems
onClipEvent (load) {friction=4;
this._x=100;
this._y=70;
}
onClipEvent (enterFrame) {if (this._y<244){this._x+=(this._x-this._x)/friction;
this._y+=(this._y-this._y)/friction;
} else {_root.draggableClip.dragButton.onRelease = function() {_root.draggableClip._x+=(100-_root.draggableClip._x)/friction;
_root.draggableClip._y+=(70-_root.draggableClip._y)/friction;
}
}
}
So basically I have a draggable clip and when It's released below a certain area I want it to ease back to it's original area. But since it's on clip event enter I'm assuming it keeps hitting the first if statement, and it only tweens a little bit and then stops.
I know my code is really sloppy, but if someone could help me I'd appreciate it.
View Replies !
View Related
For Loop And Clip Event
Hello,
onClipEvent (load) {
for (var i = 3; i<=3; i++) {
this+".ball"+i.gotoAndPlay("off");
trace(this+".ball"+i);
}
//_root.ballCounter.ballDisplay.ball1.gotoAndPlay("o ff");
}
I've got a group of MC clips of balls in a MC that are numbered ball1, ball2, ball3 etc
I've placed the above script on the MC that should target the ball MCs...but it doesn't work can any one tell me why? I've also tried using absolute targets.
The commented line in the script does work correctly...it also works using:
this.ball1.gotoAndPlay("off");
Thanks again,
SS
View Replies !
View Related
Clip Event On Dynamic Mc
I got this script off of flash kit.
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
this.gotoAndStop("over");
} else {
this.gotoAndStop("off");
}
}
My question is I'm using attach movie to dynamically put ,ovieclips on to the stage.. so where do I put the script for a clip event such as the one above??
View Replies !
View Related
Targeting On Clip Event
i have this code
onClipEvent (enterFrame) {
if (hitTest(_root._xmouse, _root._ymouse, true)) {
_root.menu.drop.nextFrame ();
} else {
_root.menu.drop.gotoAndStop (1);
}
it is on a MC in 'sub.swf'
Q. what targeting information do i have to change, cos when i import it into my main movie the event doesn't work. Obviously it works on its own.
its a simple drop down menu
rat
View Replies !
View Related
On Clip Event Problems
Ive just got flash mx 2004 and I cant find the menu were you select on release/ on press state. Have macromedia scrapped this menu for MX 2004 so you have to write the code out manually.
Can someone help. Thankyou
View Replies !
View Related
[F8] On Clip Event And MX Transitions
I have this code on my empty MC:
onClipEvent (load) {
import mx.transitions.TweenExtended;
easingType2 = mx.transitions.easing.Strong.easeOut;
this._alpha=0;
extendTween = new TweenExtended(this,["_alpha"],
easingType2,[this._alpha],[100],2,true);
}
onClipEvent (enterFrame) {
import mx.transitions.TweenExtended;
easingType = mx.transitions.easing.Back.easeOut;
this.swapDepths(_root.etbox1)
extendTween = new TweenExtended(etbox2,["_xscale","_yscale"],
easingType,[etbox2._xscale,etbox2._yscale],[120,120],1.3,true);
}
firstly i get this error message which i do not understand:
**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 13: The class 'mx.transitions.TweenExtended' cannot be imported because its leaf name is already being resolved to imported class 'mx.transitions.TweenExtended'.
import mx.transitions.TweenExtended;
Total ActionScript Errors: 1 Reported Errors: 1
secondly my code doesn't work!!!! What i want to do is fade the imported MC when it loads and then scale it up when i rollover.
any idaes where it's going wrong
cheers
Rat
View Replies !
View Related
Clip Event Question
Okay I hope everyone understands what I'm asking is a syntax question...
In my movie I use this code a lot which is attached to a movie clip..
onClipEvent(load)
{
//my commands
}
But I want to do it on frame one.
---------------------------------------------------
As a side note... I also use..
on(release)
{
//my code
}
and on frame one I use instead....
movieclip.onRelease = function()
{
// my code
}
-------------------------------
So my final question is... is there a way to write the first set of code as a function on the first frame? Such as...
movieclip.onClipEventLoad = function(){ }
Or something?
Thanks!
-Joey Avino
View Replies !
View Related
On Clip Event Help Me Understand
onClipEvent(load) {
this.useHandCursor=false;
}
this is the script on my template for the main buttons. I am hoping to add more pages and normally would have just copied the script, but I cannot decipher how this works... can you break it down for me.
View Replies !
View Related
On Clip Event Question
Hey all.
Ive got a movie clip with some animation in it, what i would like to happen is that when the timeline reaches the end frame , i would like to play the 2nd frame of the MC or go to the frame label "bottom"
iam using
Code:
onClipEvent (enterFrame) {
_root.sound.gotoAndPlay("bottom");
}
check ou the fla to see what i mean.
thanx
View Replies !
View Related
Clip Event Trouble
Man its been a long day... I seem to be having another problem with a simple code - here is the code I am using:
onClipEvent (load) {
_root.BG.logo.onRollOver = function() {
tellTarget ("_root.BG.logo.iii") {
gotoAndPlay(2);
}
};
}
This code is placed in "logo" MC actions in BG.
Logo is a MC in the MC BG on the main stage and iii is a clip within logo.
When the mouse rolls over the logo clip I want iii to start playing at frame 2. I know I am missing something stupid... please point it out! : ( Thanks a lot.
Peace
View Replies !
View Related
Using Movie Clip Event Handler Function, But Not For A Movie Clip
Let's say I have the following code:
----------------------------------------------
var initObj = new Object();
initObj.mood = "happy";
mc = attachMovie("mcBox","instBox",100,initObj);
mc.onPress = boxPress;
function boxPress() {
trace("Box mood: " + this.mood);
}
----------------------------------------------
Now, let's say there are times that I want to call boxPress() other than when the onPress event happens. Is there a way I can set up an object, give it a "mood" property, and then run boxPress() so that it uses my non-movieclip object instead of a movie clip?
View Replies !
View Related
Movie Clip Rollover Event
I have a movie which tells the timeline of another movie to play from a certain frame
EG:
on (mouseover) {
_root.MyMovie.GotoandPlay("MyLabel")
}
But when I rollout, the movie stops playing (natually). How can I get it so the movie just continues to play after the rollout occurs? (the movie that I am telling to play is an animation, and I do not want it to stop until it is done playing, and it will stop on its own)
Thanks
View Replies !
View Related
Attached Movie Clip Event?
is it possible to attach a clip event to an attached movie???
if i just click and drag an item to the stage i can give it properies like this...
code:
onClipEvent (enterFrame) {
//x movement
if (_root._xmouse<=455 && _root._xmouse>=30 && _root._ymouse<=592 && _root._ymouse>=98) {
mx = _root._xmouse;
if (mx<_x) {
dx = _x-mx;
} else {
dx = mx-_x;
}
moveSpeedx = dx/1;
if (mx<_x) {
_x = _x-moveSpeedx;
} else {
_x = _x+moveSpeedx;
}
}
}
but what if i am attaching a movie...
Thanks,
Carlos
View Replies !
View Related
Getting StopDrag To Work On A Clip Event
I'm trying to get a MC to drag with my cursor whenever the cursor moves into a designated area. The trouble is, the script for the "designated area" isn't working. I can get everything to drag correctly, but I can't get the drag to happen ONLY when the cursor is in the right area. Here's my code (it's so ridiculously long because I've been rewriting it every way to Sunday in the hopes that it's an Actionscript bug with the if statements...):
Quote:
onClipEvent (enterFrame) {
if (_xmouse < 731) {
if (_xmouse > 14) {
if (_ymouse < 146) {
if (_ymouse > 22) {
_level0.gradient.startDrag(true, 108, 87, 623, 87);
}
}
}
}
}
onClipEvent (enterFrame) {
if (_xmouse > 731) {
if (_xmouse < 14) {
if (_ymouse > 146) {
if (_ymouse < 22) {
_level0.gradient.stopDrag();
}
}
}
}
}
Any ideas on how to constrain the dragging to the area listed?
View Replies !
View Related
Movie Clip Event Problem
Hi,
I have one animation. on the very first frame i have stop the animation. On clip of a button i play the animation.
But here if i place the button on scene it works fine but if i placed a movie clip on the scene and that movieclip contains the button.
Now on click on of movie clip i tried to play the animation it doesnt work.
can anyone help me
Dhiru
View Replies !
View Related
On Clip Event In MCs Laggin Movie
does having several
onClipEvent(enterFrame){
if (_root.fade) nextFrame();
else prevFrame();
}
codes on MCs make the movie laggy....
i have a coded animation that plays fine when played by itself, but when brought into a movie that have 3 of these onClipEvent's on MCs it makes that same animation laggy...
the fps on both movies are set at 30....
what can i do to make the fluidity of the animation i want to bring in smoother?
do it lag when nested 4 MCs deep?
whats making it laggy?
thanks,
manny
View Replies !
View Related
Playing Another Clip From An Event In A OnClipEvent()
I want to play anogher clip in my movie if a hittest result is found.
I can set dynamic text if the event occurs but can't play a movie clip ?!?
Code:
onClipEvent (enterFrame) {
if (this.hitTest(_root.Player1) || this.hitTest(_root.Player2)) {
//- this text code works if a hit is detected
_root.diceText = "Ladder Hit";
//- this does'nt. although it seems to work when the frame is exited
with (_root.PopUp2) {
boxName2 = getProperty(this, _name);
_root.boxText2 = _root["ladderText"+boxName2];
gotoAndPlay(2);
}
}
}
View Replies !
View Related
Looping Clip Event Code Help?
having trouble with a clip being able to loop.
example: i have a movieclip named box.
the code on that movieclip is:
onClipEvent (enterFrame) {
this._x+=30;
}
it moves across the screen fine and all, but when its x coordinate reached 400, i want it to go back to x=5. i tried an "if" statement but it didn't work.
any ideas?
thanks
View Replies !
View Related
Movie Clip Event Handling
In actionscript I am creating a movie clip with 4 nested movie clips. I want to attach event handlers to these sub movie clips so that I can detect mouse down events and start to drag them. I need to dynamically attach and detach event handlers as I only want to be able to drag them some of the time.
I have one class which creates and updates the user interface, I want this class to register and un-register the event handlers, but a seperate class will actually handle the events.
If these where buttons I would use:
Code:
my_button.addEventListner("mouseDown", myControllerClass);
But movie clips do not support the addEventListner function! I have also tried:
Code:
my_movieclip.onMouseDown = Delegate.create(myControllerClass, myControllerClass.onMouseDown);
But this seems to attach the event listener to the parent movie clip. Help! What should I be doing.
Thanks,
Tom
View Replies !
View Related
Triggering An Event From A Nested Clip.
I have been developing a simple Roll Over menu, where a user rolls over a clip & that tweens out to give a number of options.
I have used an invisible button (controlled from a main timeline code) on top of some text nested inside the main clip, clicking on that button causes the required user driven event.
Problem.
I can not get the buttons onClick event to trigger. I imagine it’s because Flash is still responding to the holding clips on RollOver event which sets the tween rolling. I can’t see why Flash can’t pick up on the fact that the mouse is now over a nested clip & respond accordingly.
Unless anyone knows a better way, the only option I can see is to use the clips _x & _y properties together with the mouse’s to find out if the user is over the button & act accordingly.
Fla attached.
Many thanks for any help.
View Replies !
View Related
Moving A Clip Event To The Frame
Hi, I used a tutorial to create the following movement but i want to move it from the clip to the frame. It works fine with one clip on the frame, but then any duplicates just mirror the motion of the instance.
please help..!!
Code:
for (i=0; i<5; i++){
var clip = bug_mc.duplicateMovieClip ("newclip"+i, i)
clip.onEnterFrame = bugsEnterFrame ;
}
max = 21;
x_speed = max/2;
y_speed = max/2;
rotation_speed = 1;
friction = .98;
bugsEnterFrame = function () {
var rand = random(30);
if (rand == 1) {
x_speed = random(max)-max/2;
}
if (rand == 2) {
y_speed = random(max)-max/2;
}
// boundries
if (this._x >= 500) {
x_speed = -Math.abs(x_speed) * friction;
}
if (this._x <= 0) {
x_speed = Math.abs(x_speed) * friction;
}
if (this._y >= 500) {
y_speed = -Math.abs(x_speed) * friction;
}
if (this._y <= 0) {
y_speed = Math.abs(x_speed) * friction;
}
// friction
x_speed = x_speed * friction;
y_speed = y_speed * friction;
// set _x and _y
this._x = this._x + x_speed;
this._y = this._y + y_speed;
// rotation
distance_x = x_speed;
distance_y = y_speed;
theta_target = Math.atan(distance_y/distance_x) * (180/Math.PI);
if (distance_x<0 and distance_y>0) {
theta_target = theta_target + 180;
}
if (distance_x<0 and distance_y<0) {
theta_target = theta_target - 180;
}
theta_this = getProperty(this,_rotation);
theta_distance = theta_target - theta_this;
theta = theta_this + theta_distance/rotation_speed;
this._rotation = theta;
}
View Replies !
View Related
OnRollOver Event With Movie Clip
I'm trying to get cerrtain events to happen when I roll over a certain movie clip, for some reason this won't do anything. Can anyone tell me what I'm doing wrong?
Code:
mAbout.onRollOver = function(){
mItemOne.htmlText = "<a href='http://www.ninercaphell.com'>Test</a>";
mHome.rewind();
};
View Replies !
View Related
Please Review This Code/Clip Event
I have a root swf that loads a second swf into level 1. The level 1, swf when a button is clicked, there is an exit clip event that tells the level 1 swf to park at a certain label and and tells the root swf to go to a certain label.
It is this last command that does not seem to work. It does not move to the label frame.
Can someone take a look at the code and let me know if they see any errors.
onClipEvent (load) {
_level1._root.gotoAndStop("One");
_root.gotoAndStop("Out");
}
Thanks everyone
View Replies !
View Related
OnSoundComplete Vs. Movie Clip Event
Hello and Happy Holidays!
I have a movie that I am trying to sync with some external mp3 files - basically a narrated voice over.
What I am having a problem with is that, depending on which browser, computer, server, act of God, etc seems to be effecting it at the moment, it seems that sometimes the movie clip takes longer to execute than the mp3 and vice versa.
What this means is that I cannot rely on any one specific item to be the determiner of when to move on to the next movie clip. If I use "onSoundComplete" and it finishes before the current movie clip, it cuts the movie clip short. If I rely on the end of the movie clip it may cut the mp3 short. What I am trying to figure out is how to take both into consideration - sort of an "if then" statement. I've racked my brain over this one for hours until my mind is numb.
Any ideas where to start?
many thanks.
View Replies !
View Related
Movie Clip Event Handlers
I have these animated menus that kick in when you roll over them. See www.stephanieerdel.com/headermov.swf . The only problem is that I don't know the command to turn the movies off when you roll off them. If I do a rollOut event handler on the child button, it stops the movie before it's done playing.
I basically want it to play the movie while your mouse is over the link and the sublinks but when you roll off the sublinks or the main link then the movie stops playing. Is this an OnClipEvent? If so, then what is the command? And what level do I write the actionscript on?
Thanks for your help,
The Goddess
www.stephanieerdel.com/headermov.swf
View Replies !
View Related
On Clip Event Handlers Not Working
HI,
I'm having some trouble with my on clip event handlers. I'm learning action script from the macromedia action script manual and every time i write an on clip event handler, copying directly from the manual, I am getting an error message. Here's what it says as an examples....
**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 3: Statement must appear within on/onClipEvent handler
var star_array:Array = new Array();
The statement is copied verbatim out of the text book so I'm confused as to what I am doing wrong. The on event handlers have been working but none of the on clip event handlers. Is there something I'm missing in my script or do I have to dissect the problem in my preferences? Really confused, any help would be much appreciated, thanks!
paul
View Replies !
View Related
Event Listener For A Movie Clip
Hi --
I am trying to replace a stock button (from the components) with a movie
clip. The button has this code:
btnSubmit.addEventListener("click",sendData);
I deleted the button, btnSubmit, and replaced it with a movie clip with the
same instance name but that did not work. I tried the replacement as both a
"button" and a "movieclip". What is the correct event listener to get a
movie clip to fire an event when it is pressed/clicked?
Thanks
Rich
View Replies !
View Related
|