OnClipEvent ......... LoadMovie?
i wonder if anyone could help me, i'm developing a flash site with a main movie that contains a MC to wich is loaded an external movie acordint to the button section you've chosen, but the home section movie should be loaded in to the MC when you arrive to the site, without having to click the home button, how do i do that?!
FlashKit > Flash Help > Flash MX
Posted on: 11-16-2002, 12:29 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
OnClipEvent(load) And LoadMovie ?
Hi,
I bought your book "ATDG" and I can't find explanations on that :
Action script on a movieclip (named "cliptest") :
- 1st case :
onClipEvent (load) {
this.loadVariables("toto.txt");
trace("output1="+this._name);
}
onClipEvent (data) {
trace("ouput2="+this._name);
}
Output :
output1=cliptest
output2=cliptest
Which is quite normal.
2nd case :
onClipEvent (load) {
this.loadMovie("toto.swf");
trace("output1="+this._name);
}
onClipEvent (data) {
trace("output2="+this._name);
}
Output :
output1=cliptest
output1=
output2=
Which I can't understand !
Is there any explanation ?
Thanks (and sorry to bother you, but nobody can explain).
OnClipevent Doesn't Work When I Loadmovie
Anyone have any experience with loading a movieclip that contains onClipevent(enterFrame) commands that stop working..
I have a slider-type interface that uses clip events. Works fine when ran by itself but if I load it into another movie it doesnt seem to recognize the event commands.
LoadMovie / OnClipEvent(enterFrame) / FPS Issues
I'm building a flash movie that has three levels of loadMovies happening. Movie A loads movie B, which in turn loads movie C. A and B are more or less shells containing mostly actionscript and framing elements. Movie C has a fair amount of animation happening at 19fps.
When played by itself or loaded into B, movie C plays perfectly. However when C plays inside of B inside of A, it slows to a crawl.
Now I'm wondering if the culprit are five movieclips in A that all contain onClipEvent(enterFrame) actions. Is this constantly looping code indeed the probably cause of the slowdown? Any way around this?
Thanks in advance!
LoadMovie+onClipEvent(load) Problem
taken from this link:
// symbol_mc is a movie clip symbol in the library.
// It is linked to the MovieClip class.
// The following function is triggered for each instance of symbol_mc
// when it receives data.
symbol_mc.onData = function() {
trace("The movie clip has received data");
}
// dynamic_mc is a movie clip that is being loaded with MovieClip.loadMovie().
// This code attempts to call a function when the clip is loaded,
// but it will not work, because the loaded SWF is not a symbol
// in the library associated with the MovieClip class.
function output()
{
trace("Will never be called.");
}
dynamic_mc.onData = output;
dynamic_mc.loadMovie("replacement.swf");
// The following function is invoked for any movie clip that
// receives data, whether it is in the library or not.
// Therefore, this function is invoked when symbol_mc is instantiated
// and also when replacement.swf is loaded.
OnClipEvent( data ) {
trace("The movie clip has received data");
}
My problem: I am attaching variable number of MCs dynamically(not in the library), and i have to do so using flash6 or older. How can i use then loadMovie+onClipEvent handler to invoke something, if i am attaching MCs dynamically, and onClipEvent works only on MCs attached on the Stage(actions "on" those mcs, not "inside" them). Probably using classes. Any other option? and if not, can anybody guide me through assigning such class to such mc?
EDIT: Ok, i also have done following:
Code:
for(i=0; i<aPics.length; i++){
mc = mcSlideShow.attachMovie("picHolder", "mc"+i, 100+i);
trace(mc.stop()); // EDIT2
mc.onData = function(){
trace("attached: "+this)
}
}
and although the movieClip IS in library, and it DOES have MovieClip class assigned, onData event handler is NOT triggered and nothing is traced. Can the reason be "attachMovie" function?
EDIT2: aha. well, again it happened that attachMovie's methods are not yet initialized, so it was not yet "the proper time to assign" handler onData on those MCs. [only sen knows why ]. So that even trace(mc.stop()); at this point traces undefined, where it should trace [type Function], since stop is MovieClip's class method. Stupidstupidstupid.. relax...
gosh people, anybody does have a clue of a simple clean solution? I want to - basically - know, then the JPG file inside that MC was fully loaded, using loadMovie function, so that i can trigger a function [for each instance of that MC - each JPG, that is].
Thanks
LoadMovie, OnClipEvent(data) And Flashplayer-version < 5?
Hello,
i encountered some weird problems with loadMovie and older swfs.
The problem with the older versions of swfs is, that if You load them into ur application using loadMovie the onClipEvent(data)-Events aren´t executed properly if the loaded movie is older then flashplayer 5! Which results in causing some strange errors in my project...
I have attached a test-fla (Flash MX), any help on this topic is appreciated!
Test
HELP HitTest Doesn't Work When OnClipEvent(load) But OnClipEvent(enterFrame)?
Somehow it works for my embedded xml links (coz of using hitTesting) but some of the actions don't run.
Is there anyway to resolve this ?? Coz I want to have clickable xml links embedded within flash. Along with other effects that run at the same time.
I realised that I can only use onClipEvent(enterFrame) instead of onClipevent(load) to trigger the actions. But why is this so???
Hope I'm making sense here...
PS: I tried using only on(rollOver) and on(rollOut), simple button to trigger all the actions and they did. But I can't use buttons as there are xml links embedded within.
ActionScript Code:
onClipEvent(enterFrame){
if (this.hitTest(_root._xmouse, _root._ymouse, true)){
_root.button01_mc.gotoAndStop("over");
_root.image01bg.setMask(_root.blindOpen02);
_root.blindOpen01.gotoAndPlay(1);
_root.image01bg.tween("_x",10,0.75,"easeOutExpo");
_root.lines_mc.alphaTo(100,0.25,"easeOutExpo");
}else{
_root.button01_mc.gotoAndStop("up");
_root.image01bg.setMask(_root.blindClose01);
_root.blindClose01.gotoAndPlay(1);
_root.image01bg.tween("_x",760,0.75,"easeOutExpo");
_root.lines_mc.alphaTo(0,0.25,"easeOutExpo");
}
OnClipEvent(load) {this.loadMovie("pictures.jpg"); } NOT WORKING?
Hello!
I've loaded a jpg into flash using loadMovie("pictures.jpg", _root.movieName) but I don't konw way I can't do it from inside the movie:
onClipEvent(load) {this.loadMovie("pictures.jpg"); }
or using
onClipEvent(load) {loadMovie("pictures.jpg",this); }
or
onClipEvent(load) {loadMovie("pictures.jpg",_root.movieName); }
Why can't I do that?
Please teach me! Thank you!
PS loading JPGs works only for Flash 6?
OnClipEvent(keyUp) And OnClipEvent(keyDown): Misbe
Hi,
We are trying to trap the keypresses in an input text box, which is placed inside a Movie Clip, using the onClipEvent(keyUp) and onClipEvent(keyDown) events.
We have also disabled the tabEnabled properties for the button, movieclip, and textFields.
The problem:
The Flash player 7 is unable to detect the onClipEvent(keyUp) event when the Tab key is pressed. The movieClip has the focus since the type is Input Text. Interestingly, the problem only occurs in Flash player 7 (OCX version). The same code (written in Flash MX) works absolutely fine in Flash player 6 (both stand alone and OCX) and the Flash 7 stand-alone version.
What could be going here? Is this a Flash player issue? Has Macromedia changed the event behaviors or are we missing something here! What surprises us is the fact that the Flash 7 stand-alone and OCX player behavior is different!
We would be delighted to have any solution/fix that doesn’t require us to modify/recompile the code.
All suggestions are welcome!
Regards,
Varun
OnClipEvent(load) And OnClipEvent(enterFrame)
Hi all,
I'm using the code contains onClipEvent(load) and onClipEvent(enterFrame) and duplicateMovieClip() to make the snowing effect in the 2 first movie-clips but then, i cannot stop them in the next movie-clips. (All of my movie-clips in 1 scene only.)
Please help!
OnClipEvent(load) And OnClipEvent(enterFrame)
Hi all,
I'm using the code contains onClipEvent(load) and onClipEvent(enterFrame) and duplicateMovieClip() to make the snowing effect in the 2 first movie-clips but then, i cannot stop them in the next movie-clips. (All of my movie-clips in 1 scene only.)
Please help!
OnClipEvent?
i'm trying to make a seceret link;
ie. hold down 4 keys and this will load another movie
any clues???
OnClipEvent
anyone know why the following script works with the loadMovieNum but not with the gotoAndPlay??
very frustrating -
onClipEvent (enterFrame) {
if ((Key.isDown(82)) && (Key.isDown(83)) && (Key.isDown(85)) && (Key.isDown(75))) {
loadMovieNum ("rubicon.swf", 0);
}
}
onClipEvent (enterFrame) {
if ((Key.isDown(82)) && (Key.isDown(83)) && (Key.isDown(85)) && (Key.isDown(75))) {
gotoAndPlay ("rubicon", 1);
}
}
thanx in advance, nick
OnClipEvent .......help
I have a ball that is following my mouse. I would like the ball no to go outside a bounding box. I almost have it working. The below code works. Only thing is, once the ball hits any part of the bounding box it sticks to the edge and the else statement won't execute. Any help on getting the ball not to stick to the edge? Thanx in advance guys!
onClipEvent (enterFrame) {
if (this._x>570 || this._y>349 || this._x<248 || this._y<247) {
} else {
xDistance = _root._xmouse-_x;
yDistance = _root._ymouse-_y;
this._x += (xDistance)*.015;
this._y += (yDistance)*.015;
}
}
OnClipEvent
Im having a problem with onClipEvent. Whe ni try to put it in i cant type anything after it. Im using flash 5. Please help.
OnClipEvent Bug?
I have a movie clip which uses onClipEvent(enterFrame) to check the state of a variable loaded from an asp file to determine if a visitor has logged in. It was working peacefully until I added a pre-loader scene to the main movie timeline with the if FrameLoaded loop. Now the onClipEvent movie clip is not working. Help!
OnClipEvent.......what Does It Do?
Are there any tutes out there that explains the different functions of the OnClipEvent? I'm not sure how/why it is used or what the different events mean. ie: What is enterframe vs. load?
Thanks
OnclipEvent ?
I have two mc's. Instance names are box1 and box2. I also have a dynamic text box named test. Here is the code on box2. All elements are on the _root, but the text is not showing up in the textbox. Do I have this code in the wrong place? Is enterframe wrong? Thanks for your help.
Code:
onClipEvent (enterFrame) {
if (hitTest(box1)) {
var test = "This is where the box stops.";
} else {
var test = "keep going.";
}
}
OnClipEvent
I have an
onClipEvent (mouseDown) {
-->some actions
}
the question: Is it possible to have the "some actions loop, inside the onClipEvent? So when the mouse is down the actions inside the onClipEvent will loop. Thanks.
OnClipEvent
Is the onClipEvent only used in SmartClips??
I can't get it from being dim???
Thanks for any help
OnClipEvent Fun
I have a vertical nav bar that I've attached some actions to:
onClipEvent (mouseDown) {
targetX = _root._xmouse;
targetY = _root._ymouse;
}
onClipEvent (enterFrame) {
_x += (targetX-_x)/5;
_y += (targetY-_y)/5;
}
this code tells the nav bar to move to the point where the mouse was clicked, and to gradually come to a stop while doing so.
What's wrong with this, is that when the user clicks one of the buttons, it moves ever so slightly, because of the code above.
Basically, what I'm looking for is some code that tells the onClipEvent code attached to the MC of the nav bar to stop executing the code if the mouse gets pressed on one of the buttons.
Thanks for your help.
-A
OnClipEvent
When do I have to use "onClipEvent" and when only "on"?
OnClipEvent
I was trying to do something like this:
onClipEvent(enterFrame)
{
i=Random(100);
if(i==5)
{
//do some stuff
}
}
Its on a movie clip, but the code is only executing once. I wanted to have it execute at every frame. Any ideas? Thanks.
OnClipEvent (key.Down)?
I have 4 Movie Clips and each one has a sound file that starts in the middle of the movie. Using the onClipEvent(key.Down) I have tellTarged each movie to Play.
If I hit the buttons too fast, the current movies sound file won't stop and it will overlap the new movies sound file.....How can I stop this from happening??
Also the new movie won't start either till the sound from the previous movie stops. This wasn't happening till I added the sounds files?
Any help would be appreciated......Thanks
Onclipevent Help
hi can anyone me :
Take a look at this
http://www24.brinkster.com/markdawson/
As you can see from the swf file on click of the buttons
the box scales but is there away to on click of a button to check if the movie is scaled if so then scale down to show all boxes and then back up to the new position.
thanks in advanced
OnClipEvent
I am wondering how does onClipEvent work?
THe thing is I put a action keyframe on an mc instance, telling it, and another mc instance to play when it arrives to that frame.
Within these mc, there are STOP actions, but how come when the onClipEvent triggers them to play, they keep playing THROUGH the Stop actions?
OnClipEvent
Hi,
Is there a way to use more options with the onClipEvent?
e.g. I want to move the movie forward with mouseDown but also with every other key (keyDown).. is there a way to trigger both??
OnClipEvent ......
Hi,
I have a movie clip, with several movie clips inside. Each movie clip inside is used as a 'button'; but is set as a movie clip for more control.
so,
---------------------------------------------------------------
Home Portfolio Services Clients
__________________________________________________ _____________
each of the text headers is a separate movie within the box -which is also a movie- .... what I'm doing is controlling the movies inside with something like :
// CODE
onClipEvent(enterFrame)
{
if (home.hitTest(_root._xmouse, _root._ymouse, true))
{
home.gotoAndPlay(2);
}
}
//
On mouse over, it goes to frame 2 of the movie home and plays the 'on mouse over' effect I want. Now what I need, is a way to take it back to frame 1 of movie home and stop when the mouse exits the area. In sum, I need the REVERSE of the code above ...
Anybody know!??
Thanks!!
Onclipevent Of Just If?
ok im working on a very simple rpg. if i want to run a script at the beginning at a battle, that would constantly check both players HPs for >0. can i just put an if statement on frame 1 thru the end of the battle?
OnClipEvent
how do you do a onClipEvent for flash 4 or something similar to it.
If anyone knows anything remotely close to it please let me know ASAP, have a project due tommorrow and it has to play in flash 4, right now it only plays in 5 and 6.
Please help.
OnClipEvent SOS
Hi!
I'm using loadVariablesNum("vars.txt", 0 ) and loadVariables("vars.txt", "_level0/myClip") but can't seem to access any of the defined variable names in the onClipEvent(load) using the trace method.
However, if I add a button on my movie clip and trap the on(press) event I can see my variable using the trace method.
Please help,
Thanks!!
Onclipevent
What's the deal with "onClipEvent (load)" or "onClipEvent (keyDown)"? I do it just as the tutorial says to but I get this error message: "Clip events are permitted only for movie clip instances". Help?
OnClipEvent
when I using the onClipEvent in FlashMX it says -- You must export your movie as Flash 5 to use this action. There are several other actions highlighted this way. What does it all mean?????
What does this mean and how can I get around it?
DD
OnClipEvent?
This Flash MX is driving me Crazy!!! I'm trying to use this code to do something very basic.
onClipEvent (mouseDown) {
nextScene();
}
It will not work!!! What am i doing wrong? I have another scene and it's place in the action script (F9) of a movie.
OnClipEvent..........help
ok,
i wanna make a short game in flash by using actionscript (daaaa)
and i wanna make it so when i press left on the keyboard that it plays the movie clip of a person walking left.
then if i wanna turn right i press right and then it plays the movie clip that has the person walking right.
if ya get what im saying then plz help me with the best tutorial that you know of or anyinfo that you know.
thnx
if ya wanna send me anything here is me email:
stick_death@hotmail.com
thnx again
later!!!!!!!!!!!!!!!!!!!!
OnClipEvent
I have the following attached to a movie clip (Flash MX):
onClipEvent (load) {
var oneY = _y+_height+-101;
var twoY = _y+-60;
var velocity = 2;
_y = twoY+-10;
}
onClipEvent (enterFrame) {
if (hitTest(_root._xmouse, _root._ymouse)) {
_y += (twoY-_y)/1.5;
} else {
_y += (oneY-_y)/velocity;
}
}
Everything is working fairly well... just a couple of things.
When I move under the movie and out of the Flash file actually it doesn't close - any thoughts on why that would happen?
Help With OnClipEvent
I have a piece of code written to make a movie clip pop out of the side when the mouse rolls over it, and then go back when the mouse leaves the menu. The only problem seems to be that within my if statement only gets executed once. I have it set to execute the if when the mouse moves. But it only does it once. After it completes the if statement, when the mouse moves again, it never re execute the if statement. Here is the code, which is attached to the menu movie clip which is on the main stage.
onClipEvent (mouseMove) {
if (_root.menu.currentframe == 10) {
gotoAndPlay("_root.menu", 13);
} else if (_root.menu._currentframe == 1 & _xmouse<-140 & _ymouse>-310 & _ymouse<310) {
gotoAndPlay("_root.menu", 1);
}
}
Anyone know what I can do to make it rerun this if statement every time the mouse moves?
_x And _y OnClipEvent(?)
How would I go about making the lines following the mouse found here at the top of the page ??
Thanks.
Onclipevent
Hey what is the purpose of loading using the onClipEvent(Load) if you want to load variables. Why not just write them out from the beginning rather than wait. What benefit could be derived from that? Thanks
OnClipEvent
Does anyone know why this code dosen´t work?
onClipEvent (loadMovieNum ("klipp1.swf", 1))
OnClipEvent() Help Please
hi, i know that when you use the onclipevent handler with enterFrame, it works at the movie frame rate. but what about the others, i have read a few books but they do not explain it very well. can some1 give me a link to a good site that explains then, or if possible can some1 explain it to me. thanks
---Sri---
OnClipEvent
Hello! I was wondering if someone could help me. I am using the script below and what I want to do is have SEVERAL buttons with the same instance name ["inner"] driving the movieclip. I have tried but what happens is only one (the one drawn earliest) of the instances will be able to drive the clip at a time. Any suggestions?
Thanks in advance!
onClipEvent(load)
{
dir = 0;
speed = 7;
original._alpha = 0
_root.inner.onRollOver = function()
{
dir = 1;
}
_root.outer.onRollOut = function()
{
dir = -1;
}
useHandCursor = false;
}
onClipEvent(enterFrame)
{
temp = original._alpha + speed*dir;
original._alpha = Math.min(100,Math.max(temp,0));
}
OnClipEvent
hi
i'm playing with the below code:
// ON the movieclip
onClipEvent (mouseDown) {
_root.xscale = 200;
_root.yscale = 200;
}
onClipEvent (enterFrame) {
this._xscale += (_root.xscale-this._xscale)/7;
this._yscale += (_root.yscale-this._yscale)/7;
}
(courtesy of a pellepiano thread)
and would love to know how you can go back and forth from 200%
(written in the code) to 100% via a mouse press.
any help would be much appreciated.
thanks
jeff
OnClipEvent
Hi,
how can i write this in actionscript 2.0?? so i can run it from a frame and not on a movie clip?
onClipEvent (load) {
// do something
}
cheers.
G
OnClipEvent (help)
Modifying a template. Navigation menu is made of movie clips with actionscript applied. They are all the same except for the onClipEvent... those are
Code:
onClipEvent(load) {
num=1;
}
each one has a different number after num=(1 2 3 4) I have figured out these go to timeline frames marked as instances. example, num=3 goes to the frame on the timeline marked as p3.
I have added a new item in this navigation menu and need to link it
BUT this new link is in a new scene. I labeled a frame in that new scene p6. How do I write the code to got to frame p6 of the new scene?
If I do that then I'll have to change the code in all of them in scene2 in order to go back to scene1- correct?
OnClipEvent ?
The saga continues....
In the latest installment, i am still trying to get the piano working with both and upstate and downstate and the appropriate sound playing for the duration of the key press.
Here is the error flash is throwing out:
**Error** Scene=Scene 1, layer=keys, frame=1:Line 1: Statement must appear within on/onClipEvent handler
stop();
**Error** Scene=Scene 1, layer=keys, frame=1:Line 2: Statement must appear within on/onClipEvent handler
var soundkey1:Sound = new Sound();
**Error** Scene=Scene 1, layer=keys, frame=1:Line 3: Statement must appear within on/onClipEvent handler
soundkey1.attachSound("C");
Total ActionScript Errors: 3 Reported Errors: 3
I know this is probably something simple or atleast i hope so.
The code that i have entered on the first key is the new code i was recommended to try out to get it working:
stop();
var soundkey1:Sound = new Sound();
soundkey1.attachSound("C");
on (press) {
this.gotoAndStop("downstate");
//
soundkey1.start();
}
on (releaseOutside, release) {
this.gotoAndStop("upstate");
stopAllSounds();
}
on(dragOut) {
this.gotoAndStop("upstate");
stopAllSounds();
}
If i can just get the upstate/downstate + sound working i will be a very happy man!
I have put the flash file here (I apologize for the size, 3.75mb this is due to the sound clips i have imported for the first octave):
http://s39.yousendit.com/d.aspx?id=0...60WDZ8VKW75CQZ
~angrymice
OnClipEvent
Could somebody please explain onClipEvent quickly please or link me to somewhere that does. I really don't like the help in Flash. Mainly whats the different between load and enterFrame. Im guessing load is when the SWF loads?
Basically I have the timeline stopped at frame 1 using stop(); and have an MC with animation inside it and want it to play from frame 2 called "two", with the main timeline still on frame 1, when a variable changes. It goes to frame 2 but just stops and doesnt play. Grrr
onClipEvent(enterFrame){
if (_root.boxbuttmov.a==1) {
_root.boxbuttmov.gotoAndPlay("two");
}
}
Please help
[F8] OnClipEvent() - F8
Hi, I have recently been trying to learn AS2 after a long break. I understand how the buttons differm e.g, myButton.function(); but how what do I do with a Movie Clip, in the past I have always used onClipEvent(enterFrame). Is this still the case or how do I go about substituting this code.
Thanks in advance,
A4.
MX[04] Help With OnClipEvent
hello all,
I have a movie clip that acts like a button and inside the movie clip I have 2 frames. The code I have given the mc is:
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
this.nextFrame();
} else {
this.prevFrame();
}
}
That all works fine. The problem comes when I try to add an animation inside this same movie clip (frames 3-20). Then place the code on (release) gotoandplay (3) to start the animation. This movie clip starts to flicker continuously between frames 1-2. I don’t understand why cause I have a stop on frame 2. It seemed after I added the xtra frames that the flickering started to occur. What am I doing wrong? Is there a better way to do this?
OnClipEvent HELP
Using Version Flash "8"
Hello I have a problem. I am trying to make my button go to a different scene. However the buttons uses this code. Right now it pops up a link in a different window. I want to scratch that and make the button go to another scene within the flash movie.
Code on the button
onClipEvent (load) {
originY = this._y;
bttnName = "nameofbutton";
link = "ww.mysite.com";
content.gotoAndStop(2);
content.myText = "Type your text here for option number 2";
}
onClipEvent (enterFrame) {
_parent.menuScript(this);
}
Can someone help me with this???
|