PDA

View Full Version : ""The loop could be controlled by an OnClipEvent(enterFrame) loop..."" How?


CyberNated User 22
04-14-2001, 05:16 PM
I just finished ur tutorial, but what 's OnClipEvent???

CyberNated User 22
04-14-2001, 11:30 PM
"The loop could be controlled by an OnClipEvent(enterFrame) loop"

How can I do that???


I tried to figure out for hours....

Jesse
04-15-2001, 02:13 AM
Ctr F8 to create a new Movie clip. Draw somethign in it (anything, it doesn't matter), then put one copy of it on the stage.
Right click on the movie clip and go to Actions.
Then under the advanced actions drop down, select onClipEvent.
Select the radio button which says 'enterFrame'.
Now put this code in that handler:

_root.count += 1

(or " _root.count = _root.count + 1; " , they do the same thing)

So the code should look like this:

onClipEvent (enterFrame) {
_root.count += 1;
}

Then, create a dynamic text field on the stage and give it the variable name 'count'.
Ctrl Enter to test your movie.

You will see a number in the text field counting quickly up from 1 to inifinity.

This is a basic example of onCLipEvent(enterFrame). Anything within this handler is performed every frame of the movie. So, if you frame rate is 12 fps, your _root.count += 1 code is run through 12 times per second.

Now that you know this, try and figure out how, using frameEvent loops and setProperty and getProperty, you could make an object scale up and up. (Hint: you willneed to use the _xscale and _yscale properties).

This might seem harsh but I'm trying to get you to experiment and figure stuff out for yourself, you'll thank me for it in the long run :)
If you can't work it out, reply and I'll show you how.

Cheers

Jesse

CyberNated User 22
04-15-2001, 02:23 AM
That's alright!! I will try!!! thanx!!

CyberNated User 22
04-15-2001, 02:47 AM
I knew i am gonna to run into a problem...

How do i creat dynamic text field ??? Or I should ask, What is dynamic text field ???


Do u have icq or any messagers?? Maybe it'll be faster for u to help me....


thanx!!!

Jesse
04-15-2001, 03:07 AM
I don't give out my messenger details as I end up being swamped with questions.

To create a dynamic text field:
Select the text tool (the 'A' symbol). Then popup the Text Inspector (it's the inspector whose button is an A, down the bottom right of the Flash window). Sleect the text optinos tab. Sleect Dynamic Text from the drop down. Now click on the stage to create the text field. You will see a text field created and the Text Inspector box marked 'variable' will become editable. Into this variable box type "count" (without the quote).

This text field will now display the value of the 'count' variable.

Cheers

Jesse

CyberNated User 22
04-15-2001, 06:54 AM
"You will see a number in the text field counting quickly up from 1 to inifinity."



I only see a #1 stay beside the text field....

take a look at these

http://eirdynamic.tripod.com/Movie1.swf

http://eirdynamic.tripod.com/Movie1.fla

Did i do something wrong...

thanx!

---

I am just wonder is this ur job..Go around the forum and help ppl out...Do u get paid for it???

CyberNated User 22
04-15-2001, 07:27 PM
huh?? still trying to figure out..

Jesse
04-16-2001, 02:39 AM
No, I don't get paid for this, but I guess you could say that Flash is my job... I do some contractual work from time to time.

Your file links don't work, but here's some examples I made:
http://www.actionscripts.org/help/CyberNated/clipEvents/
count_up - incriments a counter every frame, forevere
conditional_count - incriments the counter only until it reaches 50 then stops, if you click the button it starts again
move_along - changes the _x of the object
scale_up - increases the _xscale and _yscale of the object

Using these examples you should be able to figure out what you need to do. Basically you need to create an onClipEvent which will scale up your clip on demand. So you can have soemthing like this:

if (scaleUp) {
// the scale code in here
}

And you can set a variable 'scaleUp' to true when you want the scale actions to occur.
You will also need another if statment to make sure your window doesn't KEEP ON scaling, so you want to do:

onClipEvent (enterFrame) {
if (scaleUp) {
if (_root.object._xscale < 100) {
// the scale code in here
}
}
}

This second if statement ensures the the clip wont keep scaling up when it reaches it's standard size...

I've given you some good hints there, now try it out and see if you can get it working.

Cheers

Jesse

CyberNated User 22
04-16-2001, 03:27 AM
oh thanx!! I am working on it...

Happy Easter!!! btw..

CyberNated User 22
04-16-2001, 10:15 PM
I knew that i am gonna to run into trouble...

I think i did something wrong in the "IF" part of actionscript...

If i don't put "if" action, the window will keep zooming out without stop....

Can u plz take a look at my Fla. , and see what did i do wrong....

http://www.geocities.com/smooth_operater_1999/drag2.fla
right clikc and save as to get the file...

thanX!!!

------------

Another question.
What does { and } mean at the end of each line of actionscript??


And, What's the way to make the zooming faster???

[Edited by CyberNated User 22 on 04-16-2001 at 04:21 PM]

Jesse
04-17-2001, 04:43 AM
You have worked very hard on this, so I think you deserve a break. I've done the ffect you want. Examine to code on the controller clip and also the new code on the Open button and the Close (X) button of the window, and the first frame of the movie.

The clip is called scaling_drag.fla

http://www.actionscripts.org/help/CyberNated/

CHeers

Jesse

CyberNated User 22
04-17-2001, 05:44 AM
hey!! thanx alot!!

I am still wondering what is "{" and "}" at the end of each line in actionscript....

thanx!

Jesse
04-17-2001, 05:48 AM
They mark the beginning and end handlers... like

onClipEvent (enterFrame{
// this line is within the handler
}
// this line is outside of the handler

if (statement) {
// this line is within the handler
}
// this line is outside of the handler


Cheers

Jesse

CyberNated User 22
04-17-2001, 05:58 AM
Oh...I see what u have done!!

But how can i prevent the window from seeing in the mainstage???
Right now,I can still see a liitle dit which is the window in the main stage...

How can i make it dissappear??
Do I make the window clip starts on FRAME 2 instead FRAME 1??

thanx !

CyberNated User 22
04-17-2001, 06:03 AM
Originally posted by Jesse
They mark the beginning and end handlers... like

onClipEvent (enterFrame{
// this line is within the handler
}
// this line is outside of the handler

if (statement) {
// this line is within the handler
}
// this line is outside of the handler


Cheers

Jesse

Thanx!! what's the difference between the line is in a handle and line is not in a handle?? thanx!

Jesse
04-17-2001, 06:38 AM
Well in this example:

if (_root.count== 4) {
// this line is performed only when the variable
// _root.count is equal to 4
}
// Any actions here are performed every time this
// script is run (on button press or when this keyframe
// becomes active

Cheers

Jesse

CyberNated User 22
04-17-2001, 04:18 PM
Oh...I see what u have done!!

But how can i prevent the window from seeing in the mainstage???
Right now,I can still see a liitle dit which is the window in the main stage...

How can i make it dissappear??
Do I make the window clip starts on FRAME 2 instead FRAME 1??

thanx !

Jesse
04-18-2001, 03:45 AM
You could do that, or you could use the visibility porperty like we did before.
So the first frame sets the xscale and yscale (as I have done) as well as doing

_root.window._visible = false

and then just make you button set

_root.window._visible = true

before it begins the scaleUp

You will also have to change the code on the close (X button) to set visibility once again to False.

Cheers

Jesse

CyberNated User 22
04-18-2001, 04:56 AM
THANK YOU!! THANK YOU!! THANK YOU!! THANK YOU!!

I finally did something that i really want!!! It won't be accompanlish without you!!!!

But, i am gonna to take it to another step! I made a "Navigation Menu" for my window.....

I ran into a problem with my MENU..take a look here...
http://eridynamic.tripod.com/menu-rotate.fla

I made a script that will make my MENU rotates by the control of my mouse. I also made my MENU draggable in the middle.

Now, here is the problem..
Once I draged the MENU to different place, I couldn't rotate the menu by my mouse anymore....

How can I fix that??

thanx in advance!! *10000 (I don't how many thanxs I need to say)

btw, Are u the webmaster of this actionscript site??

Jesse
04-18-2001, 05:13 AM
I've changed pretty much the whole thing. See the code on the button within the nav, as well as the new code in the first frame of the main stage and the new code in the control clip.

http://www.actionscripts.org/help/CyberNated/rotatemenu/

Yes I'm one of the 2 webmasters here.

Cheers

Jesse

CyberNated User 22
04-18-2001, 05:59 AM
hey! thanx!

But, i couldn't see what u have change...

can u tell me?

Jesse
04-18-2001, 06:19 AM
My code on the controller is completely different, review your orriginal compared to my version, you will see I no longer rely ont he draggable clip to get the _y position of the mouse, instead I use _ymouse and I also changed the syntax in various places.

Cheers

Jesse

CyberNated User 22
04-19-2001, 01:05 AM
oh! thanx! i got it!

Now, Back to the window...

I want to put 4 categories of text in my window...

What's ur suggestion on that...Should I make 4 different windows for my 4 differnt catrgories???

And...

For the text in the window, how can I make the Text scroll up and down using a button!! So, if the mouse hovers on the up button, the text will scroll up..

thanX!!

Jesse
04-19-2001, 06:58 AM
4 different windows, and use the Continuously Scrolling Graphic / Text object tutorial (intermediate section) or better yet wait a few days for my new tutorial on text scrolling which will be better.

Cheers

Jesse

(I think this is the longest thread I've ever seen)

CyberNated User 22
04-19-2001, 04:10 PM
Oh ! thanx! I am going to look into it!

Well, this is my first time dealing with Flash and the web designing world...
And I would like to learn it by setting a goal for myself..
I would like to learn Flash and some web-design by making a complicated profolio site for myself....

But, without you, i couldn't acheive my goal that fast!
thanx! you!

CyberNated User 22
04-20-2001, 11:23 PM
hey! can u post me a message when ur new tutorial on text scrolling is up ??

thanx!

CyberNated User 22
04-23-2001, 01:12 AM
Originally posted by Jesse
4 different windows, and use the Continuously Scrolling Graphic / Text object tutorial (intermediate section) or better yet wait a few days for my new tutorial on text scrolling which will be better.

Cheers

Jesse

(I think this is the longest thread I've ever seen)

Hey! few days have passed, did u finish ur tutorial on text scrolling..

thanx!

Jesse
04-23-2001, 06:18 AM
No, I'm a very busy man :)
I might have time today.

Cheers

Jesse

Jesse
04-23-2001, 11:22 AM
http://www.actionscripts.org/tutorials/intermediate/scrolling_text/index.shtml