ActionScript 2.0 :: If Else - Directing The Swf To Start On Different Frame Numbers Depending On The Variable

Mar 25, 2009

I am having problems with this if else statement. I have a variable (frame number 30) passing into my swf from another swf. This I know is working correctly.

[Code]...

(in case it was a string vs number issue.) it just stops - it does not go to frame 30. I need this because I need the file to stay on frame 1 if no variable is passed in. Am I doing something obvious wrong? Is there a better way to do this?

View 1 Replies


Similar Posts:


ActionScript 2.0 :: Different Frame Numbers Depending On The Variable?

Mar 25, 2009

I am having problems with this if else statement. I have a variable (frame number 30) passing into my swf from another swf. This I know is working correctly.

But - I need to be able to direct to different frame numbers depending on the variable, this is working.

But when I place this code:

[Code]...

View 2 Replies

ActionScript 2.0 :: GotoAndPlay(frame); Depending On A Variable From Php?

Apr 28, 2004

I have set the variable in my page using <param name="flashvars" value="menustate=<?php $pagename; ?>"> which works perfectly fine when I use a dynamic textbox in flash with the var name menustate.

But I need to send a MC to frame 2 if 'menustate = 2'. Anyhow, I just want to know how to control a MC with an external var. I can't use loadVars () because this var is coming from any page, not just one.

View 5 Replies

ActionScript 3.0 :: Integer Variable Matching Frame Numbers?

Oct 21, 2009

I am trying to write a short AS3 script in CS4 that allows me to step backwards and forwards through an animation. I have a stop button a play button, rewind button and a forward button. The buttons work ok apart from when I hit the rewind button sometimes it jumps to the start of the timeline rather than just step back a frame at a time. When I use the stop button and the timeline stops where it is, the rewind button steps back as required.

But, if the rewind button is clicked first it jumps to the start of the timeline, I know the theory as to why I cant get this to work. I need to know how to increment an integer variable (counter) to increment as the animation players. i.e. the counter variable to match the frame number. Below is the code I have, how to match an integer variable to the current frame and tell me where to insert the line of code on the listing.

var counter = 1;
gotoAndStop(counter);
function setupevents(){
buttonplay.addEventListener(MouseEvent.CLICK, playbutton);
buttonstop.addEventListener(MouseEvent.CLICK, stopbutton);
[Code] .....

View 2 Replies

ActionScript 2.0 :: Generate A Variable Number Of Random Numbers Less Than 16 With No Duplicate Numbers

Nov 2, 2004

how to do this and not found much, so here goes:

I want to generate a variable number of random numbers less than 16 with no duplicate numbers

Ive posted the fla, and what i'm doing is generating a random number and putting it into an array then using a for loop to cycle through the array for each new random number to check if its already there. if it is, then i want to regenerate that number.

if you test the fla you'll see that all i get in my array is some lovely zero's and i sort of know why this is, but don't know how to stop it.

View 3 Replies

ActionScript 3.0 :: Maths - When Click On The Knob It Turns 90 Either Left Or Right Depending - Get The Angle In Whole Numbers?

Mar 11, 2011

Code:
knob_mc.addEventListener(MouseEvent.MOUSE_DOWN,turn);
stage.addEventListener(MouseEvent.MOUSE_UP,endTurn );
function turn(e:Event):void[code].....

This is the code I'm using to move a knob the challenge is when i click on the knob it turns 90 either left or right depending where i click, I'd like it to stay still until I turn the knob, and second how do I get the angle in whole numbers??

View 3 Replies

ActionScript 3.0 :: Defining A Variable As 2 Separate Things Depending On Other Variable?

May 4, 2011

I'm making a platform game where all of my level components (ground, background etc.) are within an array called 'levelArray' so I can move all the elements the same amount at the same time. I'm just starting to implement my second level, and I need to change 'levelArray' to contain different level elements. I've tried to put an 'if' statement to change the definition of the variable:

[Code]...

View 3 Replies

ActionScript 1/2 :: Make The Sound Start Up Depending On When The Movie Was Played?

Apr 20, 2010

I am just a rookie in Flash, and came across a problem. I'm trying to create a flash movie that will display time like a TV ident does. I've successfully set it up to get the correct time and play a "tik-tok" sound as each second passes. However, it is to have some background music, and I can't get it to start when I need it - for instance, if the time is 18:00:00 it should start at 00 seconds, it time is 18:00:21 it should start at 21 seconds etc. This is the script I used for ticking:

[Code]...

What should I use for the complex situation as described above? My only guess is that I should sync it to the frames in the background video (behind the clock, running at 24 FPS), but I haven't got a clue how to set that up as well. Can someone please help? If necessary I can upload the .fla file.

View 3 Replies

ActionScript 2.0 :: Dynamic Text Field - Movieclip "numbers" To GotoAndStop To The Frame Number Imported Via The Variable Daysleft

Sep 11, 2005

I have a movie where a variable named daysleft will be loaded from an external text file into a dynamic text box, this bit works fine. But I then need the movieclip "numbers" to gotoAndStop to the frame number imported via the variable daysleft. Although daysleft displays on the screen a trace(daysleft); says the variable is undefined.

View 4 Replies

ActionScript 2.0 :: Start Button Needs To Start Timer And Move To Another Frame?

Apr 24, 2011

I'm trying to broaden my horizons with it and so I'm trying to do an update of a quiz program my employer has. Everything has worked well, except for the timer. The button that starts the game has two options, "study" or "exam"; if the study is selected, there is no countdown, just the score keeper. If the exam option is selected, the timer is show (counting up). But, press "Start" and while the quiz begins, the timer, in either case, does not.

I'm going to post the actionscript for the timer that was already there, as well as the start button. I'm hoping someone can explain how this timer is supposed to work and why it's not; and where the disconnect lies in pressing the start button and making it run.The timer is embedded in a movie clip, with two dynamic text boxes, that are for some have no instance name; and actionscript spread out over several frames.Frame 1:

Minutes = "00";
Seconds = "00";
Centiseconds = "00";

[code]....

View 8 Replies

Professional :: Generate A Variable That Gets +1 Or -1 Depending On Clicks?

Sep 13, 2010

Is there a way to set up an unseen variable in flash sort of like keeping score?The best way I can describe it is from the BASIC language I used to use back in the day, where on a click you can make x=x+1, or x=x-3, or whatever depending on the button you click on.And then it would display the score (i.e. whatever is the current value of x) in the corner? give me a link or the actual code you would assign to a single button that will add or subtract to a displayed score in the corner.

View 10 Replies

ActionScript 3.0 :: Change A Textfiled Depending On A Variable?

May 11, 2011

I have several textfileds in a movie clip and I want to change text in a textfiled depending on which textfield you have clicked on. So if I have clicked on at textfiled named "text1" i want:

[Code]...

And then will text1 have the same text as "inputfield", but this dosen't seems to work only if you had a textfield called "textvariable" but that is not what I want. So any ideas how you can make this function?

View 6 Replies

ActionScript 3.0 :: Display Certain MovieClip Depending On Variable?

Feb 9, 2012

I have a project where I want to display a certain movieClip based upon what variable was set earlier. I have 5 different MovieClips that need to display depending on variables.

I have the variable set and working, but how can I script this to make it that if a certain variable say Var1 is set, then it chooses to display Var1_mc?

Can I just have it load the correct one, or do I just have it change the alpha setting of the correct one?

View 8 Replies

ActionScript 2.0 :: Frame Labels And Frame Numbers?

Feb 19, 2002

For example if I wanted an action to occur untilt the movie hit the frame label I would ideally be able to do somethign along the lines of:

do {
play ();
} while (_currentFrame != "label name");

This does not seem to work, but I am hoping that this is close to something that willObviously, I can put an action to stop the clip in the labeled frame, but I only want it to stop there under certain conditions . . .

View 2 Replies

ActionScript 3.0 :: Using Frame Labels Instead Of Frame Numbers?

Mar 2, 2012

I am building a large project that could be subject to change during it's construction, I am stressing out a bit because I am relying on the timeline to go foward and backward through the structure, (as well as user having the ability to use a menu to go where ever they want). So apart form the menu that specifies where to go, there is a forward and back button using next and previous frame to go forward and backwards.

So, what if after building a large section of this, the client wants to put in an extra page? this will upset all of my navigation (OR if I put the extra page at the end of the timeline the menu will work fine but the forward adn backwards buttons wont work properly) So should I be using frame labels instead of frame numbers? (How do I do this gotoAndStop(?) Or is there some other way I should be approaching this? like having a variable to keep track of page number instead of frame numbers?

View 5 Replies

ActionScript 2.0 :: Change Key Frame Depending On Dates

Nov 29, 2011

Quite simply I need a piece of code which jumps to a certain frame based on the actual dates below.

1-4rd Dec - gotoAndStop(1);
5th Dec - gotoAndStop(2);
6-7th Dec - gotoAndStop(3);
8th Dec - gotoAndStop(4);

I have found bits of code which allows you to specify which days, but not dates. My actionscript is very beginner so I can't work out what to do.

View 2 Replies

Professional :: Navigate To One Frame Or Another Depending On Whether There Is A Correct Or Incorrect

Jul 13, 2010

how to navigate to one frame or another depending on whether there is a correct or incorrect answer for the learning interaction. I am using the CS3 drag and drop.

View 2 Replies

ActionScript 3.0 :: Different Outcome Depending On Which Frame The Mouse Is Clicked?

Mar 1, 2011

I am currently developing a game in a school project using Flash CS4 and Actionscript 3.0.  I have searched the web for assistance, but have come up empty.  Here is what I am wanting to do...
 
I have a 3 by 3 grid on screen.  Each block in the grid contains a movie clip with four targets which cycle through at 24 fps.  Each target with have a different outcome depending on which frame the mouse is clicked.I do not want the animation to stop after the frame is clicked, however.  There are several different types of targets in the game.  Some add points, some subtract points, one target has the avility to freeze the animations for a set period, and another one is basically an instant game over.  Being as how I could not find any aid via the web prior to this post, I am not even positive that this is possible to code in AS3.0.Does anyone know if this is possible, and if so, how would I go about coding it?

View 2 Replies

ActionScript 2.0 :: Movieclip Frame Depending On Mouse Angle?

Sep 21, 2010

so i have a movieclip with this script on it (this makes my movieclip rotates)

ActionScript Code:
onClipEvent(enterFrame){
angle = (Math.atan2(_root._ymouse-_y,_root._xmouse-_x)*180/Math.PI);

[Code]....

Now, i have (let's say) 30 frames inside this movieclip, and i wan't it to change is current frame depending on the angle of the mouse (example, if i point my mouse to the right, the mc goes to frame 30, if i point my mouse a little up, the mc goes to to frame 27, if i point my mouse all to the left the mc goes to frame 15... etc...)

Basically the movieclip should change it's frame depending on the mouse angle,

By the way, i don't really wan't the moviecliip to rotate (like it's doing now) i want it to change it's frame only...)

View 4 Replies

Actionscript 2.0 :: Goto Specific Frame Depending On Date?

May 7, 2011

I need to make a function (inside Flash) that will let a swf find out what date it is (each time it is loaded from a server) and then - according to the date - display a frame designated to that date. Optionally, I could have the swf load another swf based on the date.Originally I had planned to make some php wrap-around that would do the loading of different swf's for me - but this is not an option since the swf may soon be uploaded to a server that I cannot feed with php-documents (I don't get access for that - swf only!)So now I must find a way to do this within the swf. But as of right now I am clueless.

One thing I did learn during my googling the past many hours is that the "Date class" in Actionscript is risky - in that it 'reads' what date the end user has on his/her machine. So in the event that some user has the date misconfigured that will screw up what my swf will display.Therefore I am hoping that I could somehow do a variation of php's "echo date" and get the date from the server - but inside Flash. And then have that bit of data call for a certain frame/scene/loaded swf.

View 6 Replies

ActionScript 2.0 :: Change The Frame Depending On Which Button Was Pressed?

May 1, 2003

The first prob I had was when i used the load movie command the swf file was loading in the wrong position, it kept loading down and across the page. I had

PHP Code:

_root.myemp.loadMovie("banner.swf", 0); 

I dont know why this is happening but I just fixed this by doing:

_root.myemp._x = 0
_root.myemp._y = 0

The next problem Im having is that I want to change the frame depending on which button was pressed. If button two was pressed I wanted to load "banner.swf" and gotoAndStop("pg2"), If button three is pressed gotoAndStop("pg3")Ive tried some things but cant get this part right such as:

_root.myemp.gotoAndStop("pg2")
"banner.swf".gotoAndPlay

I just dont know the syntax...

View 2 Replies

ActionScript 3.0 :: Load An Image Or Clip To Stage Depending A Variable?

Jun 11, 2010

Is it possbile to make 'bumblebee' a variable?
 
var mybee:bumblebee = new bumblebee();

View 5 Replies

ActionScript 2.0 :: Change Frame Of Movieclip Depending On Relation To Mouse?

Oct 28, 2010

This is a CS4 file so and I have CS5 so if you give me either it will be awesome

I have a movie clip that follows the mouse..

Its not done yet but its gonna be a dog chasing a/the mouse...

I want to have it where the if the mouse is left or right of the following movie clip it shows it walking toward the mouse... so something like

if mouse positions is less the the cursor + 10 (pixels) goto and play frame with dog walking left and one for right up down (I want this to walk till its directly under or over mouse and then laydown or jump only when over or under mouse..

(say its a 20 pixel wide object and 10 on each side will cover the whole thing and not just the exact center pixel, thats what the 10 + movie clip position is for, but Is there a way to tell it to goto and play whatever_frame when mouse is left of any graphic on the sitting dog section??? like the equivalent of onRollLeft or whatever.)

this is the code i have.. its the top statement that doesn't work the bottom 2 do..

Code:

if (_xmouse < detail.x+10) {detail.gotoAndPlay(61);
}
detail.onRollOver = function() {
detail.gotoAndPlay(31);

[Code].....

I already created the shapes and placed them in the appropriate frames.. you should only need to mess with the actions on the instance "detail" (the dog face in frame 1 of scene 1 in layer "follower" ---- just the actionscript needed for that instance is needed in the reply.. you should not need to chage any of the layers, but if you do just tell me what you did and why.

my fla is to big to upload to this form so im placing it on my website here

View 2 Replies

ActionScript 1/2 :: Change Frame Of Movieclip Depending On Relation To Mouse?

Oct 28, 2010

Its not done yet but its gonna be a dog chasing a/the mouse. I want to have it where the if the mouse is left or right of the following movie clip it shows it walking toward the mouse... so something like
 
if mouse positions is less the the cursor + 10 (pixels) goto and play frame with dog walking left
 
and one for rightup down(I want this to walk till its directly under or over mouse and then laydown or jump only when over or under mouse.. (say its a 20 pixel wide object and 10 on each side will cover the whole thing and not just the exact center pixel, thats what the 10 + movie clip position is for, but Is there a way to tell it to goto and play whatever_frame when mouse is left of any graphic on the sitting dog section???like the equivalent of onRollLeft or whatever.)

[Code]...

View 3 Replies

ActionScript 2.0 :: Preloader To Stop On Frame Depending On Percentage Loaded?

Aug 23, 2004

I am trying to make a preloaded that stops on frames depending on how much is loaded, I want it to stay on frame 1 if 24% or less of the movies is loaded and for every 25% I want it to it to move forward a frame, So far I have done thus,

var bytes = _root.getBytesTotal();
var bytes_loaded = _root.getBytesLoaded();
if (bytes / bytes_loaded >= .25) {
_root.gotoAndPlay(2);
} else {
_root.gottoAndStop(1);
}

View 6 Replies

ActionScript 2.0 :: Make A Preloader Jump To A Frame Depending On The Quantity?

Jan 18, 2004

code to make a preloader jump to a frame depending on the quantity on the movie that has been preloaded? in ex i have a mc of a preloader if 5 percent of the movie its loaded the preloader mc will go to frame 2, if 10% the mc should go to frame 3, etc..

View 8 Replies

ActionScript 3.0 :: Start Frame And End Frame For Keyframes

Oct 11, 2010

I'm having a problem looping through my timeline, I want to use JSFL to hit each keyframe, perform an action (in this case breakapart, but thats a different question on a different thread) and then go to the next keyframe.

[Code]...

JSFL has proven to be the utter bane of my existence. I'm still relatively new to AS in general and AS3 in specific, and this is my first foray into the world of JSFL. I need to learn how to create this tool for work, and I am the only person here with any experience in javascript, so I'm pretty much on my own.

View 3 Replies

Professional :: Start The Playhead On A Frame Other Than Frame 1?

Nov 29, 2010

So I made a ridiculously long Flash animation, but now I have to break down to certain parts. It's all made in one scene.
 
My question is can I start the playhead on a frame other than frame 1. Say frame 595, I've tried gotoAndPlay(595);, but to no avail. I've searched for a good 2 hours on this too. Is something so simple not possible in Flash?

View 1 Replies

ActionScript 2.0 :: Stop On Frame Label Depending On Random Maths Answer?

Mar 9, 2012

im working on a maths style jigsaw, and ive come across a problem of sorts, ive set random1_txt.text to 1 and random1_txt.text to 2 for testing, basically i want to randomise two textfields between 1 and 10, and also randomise the sign between either a - or a +

the answer can be computed by flash, now what i need it to do is stop on the frame number of the answer in answer_mc, these frames contain graphics of all numbers 1-20 in alpha format, this is so that the answer is in place, now the user can drag and drop movieclips into the answer box, and receive a correct or incorrect response

im at a loss on how to do this, i havent gotten around to randomising the sign as of yet i need to do more research but the general idea is as above

Code:
var startX:Number; //start of draggable piece
var startY:Number;
random1_txt.text = "1"

[Code].....

View 3 Replies

ActionScript 3.0 :: Rotate An Object (mc) Clockwise Or Anticlockwise Depending On The Value Of A Variable Called 'angle'?

Aug 31, 2009

Essentially I'm just trying to rotate an object (mc) clockwise or anticlockwise depending on the value of a variable called 'angle'.If 'angle' is positive it should go anticlockwise.If 'angle' is negative it should go clockwise.

Option 1

PHP Code:

if(angle > 0) {
mc.rotation += rotateIncrement;
}

[code]....

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved