Help With Conditional Statement Syntax
hey peeps, can somebody help me write this into a conditional statement?
if all the frames in a movieclip called boximage have played, load these movies into these levels, otherwise wait until all the frames in the movieclip called boximage have loaded.
somebody please?
KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 12-10-2004, 10:08 PM
View Complete Forum Thread with Replies
Sponsored Links:
Help With Conditional Statement Syntax
hey peeps, can somebody help me write this into a conditional statement?
if all the frames in a movieclip called boximage have played, load these movies into these levels, otherwise wait until all the frames in the movieclip called boximage have loaded.
somebody please?
View Replies !
View Related
Syntax For Conditional Statement With Array Position...
Okay guys,
What am I doing wrong now?
This is my code:
trace(_iconWood1b[4]);
if (_iconWood1b[4] == iconWood_mc)
{
removeChild(_iconWood1b[4]);
delete _iconWood1b[4];
trace(_iconWood1b);
}
The output from the trace statement is:
[object iconWood_mc]
My delete and removeChild don't fire. I tried:
if (_iconWood1b[4] == [object iconWood_mc])
but it complained about the brackets.
View Replies !
View Related
Need Syntax For Conditional Button
I have a "Build-A-Bike" project where the user clicks one of many buttons which "add" parts to a motorcycle. The ADD button does 3 things: 1.Using setTransform it changes the alpha of the parts(MovieClips.aa = +100) on the stage so they are visible, 2. Replaces dynamic text on the parts list (to show price and indicate parts picked), and 3. Adds the price (total = total+500) to the dynamic total box.
So far a winner. I also have a "remove" button which "undoes" all those things for each "Add" button.
The problem:
Each time you hit the button it adds, or subtracts from the total...as in more than once. You can subtract the price of a gas tank 10 times and have a negative total. I need the syntax for a conditional statement(basically). I need it to heck that the ALPHA of a given movie clip is 0 or 100 and use it as a condition for executing the change in the value of the totalvar. Something like this?:
(((So if gastank.aa = 0 then total = +500 else total = +0, )))that way if the movieclip is invisible(alpha @ 0) it knows not to subtract again from the total.
Otherwise I will have a very confusing interface! any help is greatly appreciated. I can send a .fla if anyone wants to examine it...
bigbrain28@yahoo.com
View Replies !
View Related
Question About ?: Conditional Syntax
Wondering if its possible to use "else" and "else if" with this syntax?
Also is it possible to use other bitwize opperators in conjunction with this.
eg:
|,&&,<>,<,>
Code:
x = "c";
x ? "l" : trace("no it doesn't = l" );
// trace message = no it doesn't = l
--------------------------------------------------
x = "l";
x ? "l" : trace("no it doesn't = l" );
// no message!
Thanks for any help...
let me know if this is a stupid question.
View Replies !
View Related
If <- Conditional Statement ?
I've created a text movie which shakes at the end. I used about 10 keyframes to position the text all over the place which give is the shaking apperence. I want to control the number of times my gotoAndPlay loop with a If condition.
I've tried several different types of conditions:
count = 1;
if (count <=20){
gotoAndPlay (16)
count++;
}
stop();
Q. why doesn't this loop the goto function until the counter is 21.
My objective is the control the number of times the text shakes without using keyframes to do it. It it possible or did i even make sence, somebody help!!!
View Replies !
View Related
Help With Conditional Statement.. I Think?
Hey Guys,
I am not a programmer, so have no idea how to set this up. Any help would be appreciated.
Take a look at the link before you read on.
http://www.ednacional.com/port/SBliss.html
Basically there are 3 photos, 2 set to 0% alpha and 1 set to 100% and each have a mini page icon which changes the photo that is visible. i when the side bar opens i want it to find out which photo is visible and have the appropriate icon on rollover state (grow) so you always know which of the photos are visible.
DOWNLOAD MY FLA
Thanks for any help or suggestions!
View Replies !
View Related
Conditional Statement
I have buttons within an MC that I'm using to navigate to different frames of the MC.
eg,
ActionScript Code:
lb_btn.addEventListener(MouseEvent.CLICK, lauren);
function lauren (e:Event) {
gotoAndStop (38);
}
I'm trying to include a conditional statement that will change the button instance alpha if the playhead is at a specific frame (and have the alpha return to normal when the playhead moves again).
I have
ActionScript Code:
if (currentFrame -- 38) {
lb_btn.alpha = 0
}
else
{
lb_btn.alpha = 100
}
But I'm getting an undefined property error. Does this condition need to be part of a function that's triggered with the CLICK event? Can you do two functions from one event?
View Replies !
View Related
Help With Conditional Statement
1. I have given a group of button an onPress value of "w" so that I can reference them in a timeline of another movie clip.
In the timeline I have a conditional statement that checks for the value of "w" if the value matches any of the values in my list ...
then the playhead jumps 2 frames onto the last frame in the movie clip.
2. on the last frame there is another conditional statement that check the onPress "w" value again. This time if the value is equal to any of the prelisted values, the playhead goes back to the first frame.
3. My Problem - After the playhead goes to the first frame which has nothing in it but sends the playhead to the next frame with the 1st conditional I talked about, the values of the onPress I set is being read and matched...but the playhead does not respond.
I think - the value of one of the prelisted onPress buttons are still true.. which is preventing the condition from carrying out the code..
4. What do I do?
(Will post the file .. if my request to too confusing.. )
View Replies !
View Related
Is This A Conditional Statement?
I'm at a beginner level in Action-script 3.0 and I'd like create a point and click animation interaction similar to Puzzleland. So what should I look up? Is the interaction based on conditional statements?
Here's the links Puzzleland if you are unfamiliar...
http://www.gtds.net/Puzzle-Land/
Edited: 10/27/2008 at 03:04:01 PM by barredow
View Replies !
View Related
Conditional Statement Help
i'm trying to add simple rollover rollout animations to my gallery page but i have a problem
my thumbnails are animated (for example they slide into the page) then on the last frame of that animation is a 2nd movie clip in which the rollover_rollout animations lay
here is my code:
function over(){
this.gotoAndPlay("over");
}
function out(){
this.gotoAndPlay("out");
}
this.winter_mc.onRollOver = function(){
this.gotoAndPlay("over");
}
this.winter_mc.onRollOut = function(){
this.gotoAndPlay("out");
}
However, someone named junkerjorg was kind enough to look at my FLA file and to tell me me that I need a conditional statement to check if my first animation file was done playing bc the AS is on the first frame of my main timeline the rolloverout animations aren't working
I really need to get this working but I know nothing about conditional statements- if anyone could be so kind enough to help me write one god id be so thankful
The file can be accessed at www.creclooart.com/justin/gallery.fla
u will be saving my life NO joke
View Replies !
View Related
Conditional Statement
Dear all,
I'm designing an application that will calculate energy needs for horses. This takes a lot of user input, e.g. age, weight, gender, activity, etc. I collect the input and use it in simple formulas to arrive at a certain energy value.
A major structural divide is wether the horse is less than 3 years old or not. So, I ask this question and move to one of two forms/movies. First question, how is this conditional branching done, if >3 years go to movie/form A else movie/form B? Second question, should I use forms or movies? This is to get me started!
I get the part with setting up text boxes for input etc. Also, I'm not totally new to programming just new to Flash, which by the way seems like a very cool piece of software.
Sincerely, Lejonberg
View Replies !
View Related
Help With Conditional Statement.. I Think?
Hey Guys,
I am not a programmer, so have no idea how to set this up. Any help would be appreciated.
Take a look at the link before you read on.
http://www.ednacional.com/port/SBliss.html
Basically there are 3 photos, 2 set to 0% alpha and 1 set to 100% and each have a mini page icon which changes the photo that is visible. i when the side bar opens i want it to find out which photo is visible and have the appropriate icon on rollover state (grow) so you always know which of the photos are visible.
DOWNLOAD MY FLA
Thanks for any help or suggestions!
View Replies !
View Related
Conditional Statement
I'm working on a project that involves the use of many conditional statements. Unfortunately logic has always been my weakest link. Here is the setup:
The background of the movie is a flowchart style image, with arrows pointing to the next sequential item. The ones along the top are obviously needed to be completed before the ones below it, and follow a series of arrows. Right now I can click on the bubbles and shade them individually, but I'm trying to get it so if you click further down the chart, everything needed to get to that point, becomes shaded.
I'm shading using a black movie clip with its alpha adjusted.
Example of how I shade the buttons:
Code:
Button12.onRelease = function() {
if (this._alpha == 0) {this._alpha = 65}
else {this._alpha = 0};
};
An example of what I'm trying (current code that doesn't work):
Code:
if (Button11._alpha == 65) {
Button1._alpha == 65;
Button2._alpha == 65;
Button3._alpha == 65;
Button4._alpha == 65;
Button5._alpha == 65;
Button6._alpha == 65;
Button7._alpha == 65;
Button8._alpha == 65;
Button9._alpha == 65;
Button10._alpha == 65;
}
As I said before I can't get it to work, it doesn't come up with any errors, but it doesn't do as I intend it to. Any and all help is appreciated.
I had it in a while loop for testing purposes, and it would just crash, but it would shade them all without me clicking on anything. Should I be using an if statement?
View Replies !
View Related
Conditional Statement
I was wondering what the rules are for declaring variables which you would increment say in an for loop. I tried to declare a variable outside the for loop, and then increment it within the loop but that didn't work. If there is a tutorial anyone knows of that would be great too.
View Replies !
View Related
Conditional Statement
Hello,
I'm currently working on a puzzle.
The objective of the puzzle is to place the numbers in
order from 1 - 10
Once the puzzle is complete you're taken to a specific frame.
However, I want to be able to go to 1 of 2 frames
depending on how long it takes to complete the puzzle.
Each number has the following code:
on (press) {
startDrag(this, true);
}
on (release) {
stopDrag();
if (this._droptarget == "/box1") {
_root.corSound.start();
_root.count = _root.count+1;
_root.cnt = _root.count;
this._visible = false;
tellTarget ("/box1") {
gotoAndStop("pic");
_alpha = 100;
}
if (_root.count >= 10) {
tellTarget ("/") {
_root.gotoAndStop(4);
}
}
} else {
_root.wrSound.start();
}
}
View Replies !
View Related
Help (conditional Statement)
Hi,
I'm pulling my hair out!
Can someone please help?
I'm working on a puzzle game.
At present, when all the pieces are put in place it takes you to a specific frame.
However I want to be able to go to 1 of 2 screens depending on the time the puzzle has been completed. I've added the code below.
Below I have code for a timer
Code:
//if (Hours==0 && Minutes==0 && Seconds==0){
if (Minutes==0 && Seconds==0){
gotoAndPlay(13);
}
else {
if (Seconds>0){
Seconds--;
}
else {
if (Minutes>0) {Minutes--; Seconds=59;}
else {
//Hours--;
Minutes=59;
Seconds=59;
}
}
if (Seconds<10){
// Timer=Hours+":"+Minutes+":0"+Seconds;
Timer=Minutes +":0"+ Seconds;
} else if(Minutes<10){
//Timer=Hours+":0"+Minutes+":"+Seconds;
Timer="0"+ Minutes +":"+ Seconds;
//} else Timer=Hours+":"+Minutes+":"+Seconds;
} else Timer=Minutes+":"+Seconds;
//if (Hours>=0 && Minutes>=0 && Seconds>=0) gotoAndPlay(2);
if (Minutes>=0 && Seconds>=0) gotoAndPlay(2);
var TimerA,sisaMin,sisaSec;
if (Seconds>30){
sisaSec = 90 - Seconds;
sisaMin = 1 - Minutes;
} else if (Seconds<30) {
sisaSec = 30 - Seconds;
sisaMin = 2 - Minutes;
}
if (sisaSec<10){
TimerA=sisaMin +":0"+ sisaSec;
} else if(sisaMin<3){
TimerA="0"+ sisaMin +":"+ sisaSec;
//TimerA=sisaMin +":"+ sisaSec;
} else TimerA=sisaMin+":"+sisaSec;
_root.disp_time_2="Well done, 20 points in " + TimerA + " min:sec.";
}
if (sisaMin==0){
_root.disp_time_2="Awesome, 20 points in less than 1 minute";
}
Below is the code i have for a puzzle piece
Code:
on (press) {
startDrag(this, true);
}
on (release) {
stopDrag();
if (this._droptarget == "/box9") {
_root.corSound.start();
_root.count = _root.count+1;
_root.cnt = _root.count;
this._visible = false;
tellTarget ("/box9") {
gotoAndStop("pic");
_alpha = 100;
}
if (_root.count >= 10) {
tellTarget ("/") {
_root.gotoAndStop(4);
zwee111.start();
}
}
} else {
_root.wrSound.start();
}
}
Thanks
View Replies !
View Related
Syntax And Conditional Function Reference
Hey everyone!
I am rather new to Actionscript 3.0 and Flash. (Only 3 days of experience.) The last 2 days I have been trying desperately to find a fix to some code errors that I have been having.
I am having difficulties with 1084 syntax error and the 3553 warning. I currently have 3 buttons that display 3 changing graphics. My goal is to have the artwork transition back and forth depending on the button pushed. I know that the code is extremely sloppy and rather cluttered, my apologize. I have no idea where to go from here or how to get to where I would like to be. Any help would be greatly appreciated.
Here is the singly function out of context in regards to the entire file:
Code:
function shirtBase(event:MouseEvent):void
{
if(design_bu)
{
this.fadeInDesignS;
this.fadOurShirt;
trace("fadeInDesignS *");
}
else(vNeck_bu)
{
this.fadeInNeckS;
this.fadOurShirt;
trace("fadeInNeckS *");
}
}
And here is the complete file so that you can see it in full context:
Code:
import fl.transitions.Tween;
import fl.transitions.easing.*;
var inTween:Tween;
var outTween:Tween;
//SHIRT
shirt_bu.addEventListener(MouseEvent.ROLL_OVER, buOver);
shirt_bu.addEventListener(MouseEvent.ROLL_OUT, buOut);
//var fadeInNeckS:Function;
//var fadeInDesignS:Function;
//var fadeOutShirt:Function;
shirt_bu.addEventListener(MouseEvent.CLICK, shirtBase)
function shirtBase(event:MouseEvent):void
{
if(design_bu)
{
this.fadeInDesignS;
this.fadOurShirt;
trace("fadeInDesignS *");
}
else(vNeck_bu)
{
this.fadeInNeckS;
this.fadOurShirt;
trace("fadeInNeckS *");
}
}
function fadeInNeckS(event:MouseEvent):void
{
inTween = new Tween(vNeck_pic,"alpha",None.easeNone,0,1,1,true);
this.fadeOutShirt;
trace("fadeInNeckS ***");
}
function fadeInDesignS(event:MouseEvent):void
{
inTween = new Tween(design_pic,"alpha",None.easeNone,0,1,1,true);
trace("fadeInShirtS ***");
}
function fadeOutShirt(event:MouseEvent):void
{
outTween = new Tween(shirt_pic,"alpha",None.easeNone,1,0,.2,true);
trace("ShirtOut *")
}
//V NECK
design_bu.addEventListener(MouseEvent.ROLL_OVER, buOver);
design_bu.addEventListener(MouseEvent.ROLL_OUT, buOut);
//var fadeInDesignN:Function;
//var fadeInShirtN:Function;
//var fadeOutNeck:Function;
design_bu.addEventListener(MouseEvent.CLICK, neckBase)
function neckBase(event:MouseEvent):void
{
if(shirt_bu)
{
this.fadeInShirtD;
this.fadeOutNeck;
trace("fadeInShirtN *");
}
else(design_bu)
{
this.fadeInDesignD;
this.fadeOutNeck;
trace("fadeInDesignN *");
}
}
function fadeInDesignN(event:MouseEvent):void
{
inTween = new Tween(design_pic,"alpha",None.easeNone,0,1,1,true);
trace("fadeInDesignN ***");
}
function fadeInShirtN(event:MouseEvent):void
{
inTween = new Tween(shirt_pic,"alpha",None.easeNone,0,1,1,true);
trace("fadeInShirtN ***");
}
function fadeOutNeck(event:MouseEvent):void
{
outTween = new Tween(vNeck_pic,"alpha",None.easeNone,1,0,.2,true);
trace("ShirtOut *")
}
//DESIGN
design_bu.addEventListener(MouseEvent.ROLL_OVER, buOver);
design_bu.addEventListener(MouseEvent.ROLL_OUT, buOut);
//var fadeInNeckD:Function;
//var fadeInShirtD:Function;
//var fadeOutDesign:Function;
design_bu.addEventListener(MouseEvent.CLICK, designBase)
function designBase(event:MouseEvent):void
{
if(shirt_bu)
{
this.fadeInShirtD;
this.fadeOutDesign;
trace("fadeInShirtD *");
}
else(vNeck_bu)
{
this.fadeInNeckD;
this.fadeOutDesign;
trace("fadeInNeckD *");
}
}
function fadeInNeckD(event:MouseEvent):void
{
inTween = new Tween(vNeck_pic,"alpha",None.easeNone,0,1,1,true);
trace("fadeInNeckD ***");
}
function fadeInShirtD(event:MouseEvent):void
{
inTween = new Tween(shirt_pic,"alpha",None.easeNone,0,1,1,true);
trace("fadeInShirtD ***");
}
function fadeOutDesign(event:MouseEvent):void
{
outTween = new Tween(design_pic,"alpha",None.easeNone,1,0,.2,true);
trace("DesignOut *")
}
//UNIVERSALS & CLASSES
function buOver(event:MouseEvent):void
{
event.target.alpha -= .5;
}
function buOut(event:MouseEvent):void
{
event.target.alpha = 1;
}
//WEBSITE BUTTON
website_bu.addEventListener(MouseEvent.ROLL_OVER, buOver);
website_bu.addEventListener(MouseEvent.ROLL_OUT, buOut);
var link:URLRequest = new URLRequest("http://www.flickr.com/photos/37172578@N00/");
website_bu.addEventListener(MouseEvent.CLICK, onWebsite);
function onWebsite(event:MouseEvent):void
{
navigateToURL(link);
}
//THREADLESS BUTTON
threadless_bu.addEventListener(MouseEvent.ROLL_OVER, buOver);
threadless_bu.addEventListener(MouseEvent.ROLL_OUT, buOut);
var link1:URLRequest = new URLRequest("http://www.threadless.com/profile/779553/atoolbox23");
threadless_bu.addEventListener(MouseEvent.CLICK, onThreadless);
function onThreadless(event:MouseEvent):void
{
navigateToURL(link1);
}
View Replies !
View Related
Conditional Statement Problem In MX
I hope someone can help me out here. What I built is a text field that is somewhat faded into the background. Above that I have another text field, but it is masked by a rectangular box that moves across the screen using actionscript. This is to give the effect that the line bolds each line that is read.
Now since there are paragraphs, I didn't want the mask to go over empty lines, so I put in a switch statement to where when squareY (squareY=_y condition is equal to a blank line, it will add to 15.4 to squareY to move it to the next line. The final case statement resets the box to the top line and starts over. I have put the code below.
The problem is, when it reaches above 177.5, it ignores the remaining case statements. I tried commentting all others and just test the return code (even tried in a separate if statement to test with no other conditions) and it ignores it. Any suggestions?
<B>FRAME ONE<B>
//initalize vars
start = -580;
end = 609;
xSpeedInit = 25;
<B>FRAME 2<B>
//allow for var to be incremented to speed or slow bar
xSpeed = xSpeedInit;
squareX = _x;
squareY = _y;
//checks for blank line and skips
switch (squareY) {
case -68.9 :
squareY = squareY + 15.4;
break;
case 69.7 :
squareY = squareY + 15.4;
break;
case 115.9 :
squareY = squareY + 15.4;
break;
case 177.5 :
squareY = squareY + 15.4;
break;
case 239.1 :
squareY = squareY + 15.4;
break;
case 269.9 :
squareY = squareY + 15.4;
break;
case 316.1 :
squareY = -176.7;
break;
}
//moves bar across screen
squareX = squareX+xSpeed;
if (squareX > end){
//if EOL reached, reset to start of next line
squareX = start;
squareY = squareY+15.4;
trace(squareY);
}
_x=squareX;
_y=squareY;
trace("SquareYEnd=" + squareY);
<B>FRAME 3<B>
gotoAndPlay(2);
View Replies !
View Related
Help With Conditional Statement And MovieClips
Hello everyone,
I need to write a conditional statement that checks to see if a movieclip is playing and perform an action.
I need the action to be attached to a button and work something like this:
on (rollOver){
with (_root.MovieClip2){
gotoAndPlay (1);
}
if (_root.MovieClip1) playing!=true{
with (_root.MovieClip1){
gotoAndPlay (10);
}
else MovieClip2 just continues playing.
I just don't know the correct syntax to check whether or not a MovieClip is playing or not. Is this the correct way to do this, or???
Any help greatly appreciated!
View Replies !
View Related
MX: Using Conditional Statement Correctly
hey i just want to know how to tell a clip to do an action onPress (in this example load a movie and gotoAndStop on a key frame, however if the clip is not the selected clip then the clip "back=true"(so that it will rewind) here is what i have. the problem i am having is that the clip is always going back onPress. how can i state it so that if it is the right clip then back=false
?
Code:
on (press) {
mainMainTimeline.servicesNavContainer_mc.loadMovie ("servicesNav.swf");
mainNavMainTimeline.main1.gotoAndStop("press");
if (mainNavMainTimeline.focusMain != mainNavMainTimeline.main1) {
back = true;
}
onClipEvent (enterFrame) {
if (back) {
this.prevFrame()
}
}
edit: if someone really wants to help and take a look at my file that would be great...
View Replies !
View Related
?variables? ?conditional Statement? Help?
Now I am in variables...
have no clue...
that first part was hard enough.
what is the code to make the buttons go frome frame to frame with variables?
if (variable < 30
variable = variable + 1;
face.nextFrame();
}
Is that it? Do I just put that in once? or am i missing something?
View Replies !
View Related
Shortening A Conditional Statement
I was wondering if anyone could advise me on how to shorten this code.
Quote:
on (release) {
}
if (_root.elev5.fived.fived2) {
_root.elev5.fived.gotoAndPlay(7);
}
if (_root.elev5.fivee.fivee2) {
_root.elev5.fivee.gotoAndPlay(7);
}
if (_root.elev5.fivef.fivef2) {
_root.elev5.fivef.gotoAndPlay(7);
}
}
I have about seven more of these "elev" movies to reference and don't want to bog down my time or the file with unneeded code.
Thanks
View Replies !
View Related
If Statement Only Working For First Conditional
I am making a transition content system, where by clicking on the navigation, it checks what section is currently active, fades that section out, before bringing in the section being clicked on. However, on my navigation, there is something that doens't makes sense. Here is my code:
nav1_mc.onRelease = function() {
if (_root.section=1) {
_root.content_mc.gotoAndPlay(3);
_root.section = 1;
_root.entering = 10;
} else if (_root.section=2) {
_root.content_mc.gotoAndPlay(5);
_root.entering = 10;
_root.section = 1;
} else if (_root.section=3) {
_root.content_mc.gotoAndPlay(7);
_root.entering = 10;
_root.section = 1;
} else if (_root.section=4) {
_root.content_mc.gotoAndPlay(9);
_root.entering = 10;
_root.section = 1;
} else if (_root.section=5) {
_root.content_mc.gotoAndPlay(11);
_root.entering = 10;
_root.section = 1;
} else if (_root.section=6) {
_root.content_mc.gotoAndPlay(13);
_root.entering = 10;
_root.section = 1;
}
};
This is on all 6 buttons, with of course the nav1 changed to nav(x) and the section being set accordingly to what button was pressed. Now I am tracing my _root.section variable, and it is getting changed. For example, when you click on button 5, it changes the section to 5, just like it should, and my trace varifies this. But then, each time I click on any button, it fades out the section 1 content, as though _root.section=1 were always true! I have no idea why this is happening. Why is only the first conditional being accepted here, and no matter what the actual _root.section variable, it is always performing the actions of the first "if" variable!
View Replies !
View Related
Conditional Statement Confusion
So I understand how a conditional statement works at its simplest level. Problem is, my understanding is too simple.
Here's what I would like to accomplish:
Say I have an instance of a movie clip - jumper_mov - on frame 1 of the main timeline. The movie clip is 30 frames long. I would like to advance to frame 2 of the main timeline when the movie clip reaches frame 30.
My feeling is that I need to use a conditional statement, but I've really no clue how to accomplish this.
If you respond, could you please be mindful of my flash ignorance and explain any code/jargon that would most likely confuse me?
Thanks friends!
peace
View Replies !
View Related
[CS3] Please Help With A Simple Conditional Statement
Horizontal scroll menu keeps falling off the stage when cursor is on right side. I really need some help!
I have attached the file and below is the code. Thank you in advance!
var myShape:Shape = new Shape()
myShape.graphics.beginFill(0x7E00E3);
myShape.graphics.drawRect(50,10,450, 100)
addChild(myShape)
menu_mc.mask=myShape
stage.addEventListener(Event.ENTER_FRAME, movemenu);
function movemenu(myevent:Event):void {
menu_mc.x = menu_mc.x + (0.5 * myShape.width - mouseX) / 10;
if (menu_mc.x>300) {
menu_mc.x=300;
}
}
View Replies !
View Related
Please Help With A Simple Conditional Statement
Horizontal scroll menu keeps falling off the stage when cursor is on right side. I really need some help!
I have attached the file and below is the code. Thank you in advance!
var myShape:Shape = new Shape()
myShape.graphics.beginFill(0x7E00E3);
myShape.graphics.drawRect(50,10,450, 100)
addChild(myShape)
menu_mc.mask=myShape
stage.addEventListener(Event.ENTER_FRAME, movemenu);
function movemenu(myevent:Event):void {
menu_mc.x = menu_mc.x + (0.5 * myShape.width - mouseX) / 10;
if (menu_mc.x>300) {
menu_mc.x=300;
}
}
View Replies !
View Related
Conditional Statement For Button
Hello...this is a straightforward conditional statement that I am having trouble with and I hope I will be able to explain it well.
I want a button called "next_btn" to change a variable called "pres" to whatever variable is next in the sequence. So on the first click it will change pres=vice and then the second time it is clicked it will change it to pres=vice2 and the third time pres=sec and the fourth pres=trea.
I am sure there are many ways to do this. My first thought was an if statement where if(pres=vice) {pres=vice2;} and so on. An easier way would be a switch statement but I am not sure of the syntax. Another way would be to change the variables to numbers and do a loop so that every time the next button is clicked it adds 1 or something but again I am not sure how to write this out. Please help...this is what I have so far:
next_btn.onRelease = function() {
nextImage();
if(pres=pres){
pres=vice;
}
else if (pres=vice) {
pres=vice2;
}
};
but when I click the button a second time it doesn't change the variable to vice2. Thanks for the help...
View Replies !
View Related
Struggles With Conditional Statement
I have a for loop that populates 16 movieClips with dynamic text:
Code:
myVars.onLoad = function(success) {
for (b=1; b<17; b++) {
butt = eval("rd1tm"+b);
if(b < 10) {
butt.Text= " " + b + "" + this["rd1tm"+b];
} else {
butt.Text= b + "" + this["rd1tm"+b];
}
This works fine, I have in this same loop, an event handler to change this MC into buttons:
Code:
_level0["rd1tm"+b].onRelease = function() {
//trace(this);
}
and these events work fine, however how do I do the following?
if(_level0.rd1tm1 || _level0.rd1tm16 is released) { do something}
and second part of this question is how do i test to see if a variable exists, in PHP and Perl there is a conditional value of if(defined($var)) {do something} but it doesn't seem to work in flash, how would I check to see if the variable has been defined?
View Replies !
View Related
Conditional Statement Question
I have thumbnail gallery. For a given tn MouseOver scales it up slightly, MouseOut shrinks it back, MouseDown brightens it, and MouseUp displays the selected image in the main image area AND darkens that tn.
All fine, except I want the tn to stay darkened while its main image is displayed and to go back to its "normal" state only after MouseUp on another tn.
How would I write an if/else statement such that if the selected main image (mainImage_mc frames 11 - 20) is up, then the intShrink function - gotoAnd Play(8) of the tn movie clip will not be called and, instead, a function specifying gotoAndStop(25) would be called - leaving the tn dark.
Otherwise, if the target tn's image is not displayed, it can shrink back as it presently does.
Many thanks for any help.
Code for one of the images is here:
ActionScript Code:
//INTERIOR IMAGE
int_tn_mc.addEventListener(MouseEvent.MOUSE_OVER, intGrow);
function intGrow(Event:MouseEvent):void
{
int_tn_mc.gotoAndPlay(1)
}
int_tn_mc.addEventListener(MouseEvent.MOUSE_OUT, intShrink);
function intShrink(Event:MouseEvent):void
{
int_tn_mc.gotoAndPlay(8)
}
int_tn_mc.addEventListener(MouseEvent.MOUSE_DOWN, intBrite);
function intBrite(Event:MouseEvent):void
{
int_tn_mc.gotoAndPlay(15)
}
int_tn_mc.addEventListener(MouseEvent.MOUSE_UP, intDark);
function intDark(Event:MouseEvent):void
{
int_tn_mc.gotoAndPlay(21)
mainImage_mc.gotoAndPlay(11)
}
View Replies !
View Related
Container Swf Conditional Statement
I'm writing a conditional statement that loads a swf, if a swf is currently loaded into a container movie clip. I'm not having a lot of success. Here's my code:
Code:
function Button(event:MouseEvent):void {
if (container_mc("1.swf") = true){
imageLoader.load(imageRequest);
container_mc.addChild(imageLoader);
}
}
I'd appreciate it if anybody could steer me in the right direction.
View Replies !
View Related
Help With A Simple Conditional Statement
Horizontal scroll menu keeps falling off the stage when cursor is on right side. I really need some help!
I have attached the file and below is the code. Thank you in advance!
var myShape:Shape = new Shape()
myShape.graphics.beginFill(0x7E00E3);
myShape.graphics.drawRect(50,10,450, 100)
addChild(myShape)
menu_mc.mask=myShape
stage.addEventListener(Event.ENTER_FRAME, movemenu);
function movemenu(myevent:Event):void {
menu_mc.x = menu_mc.x + (0.5 * myShape.width - mouseX) / 10;
if (menu_mc.x>300) {
menu_mc.x=300;
}
}
View Replies !
View Related
Question About A Conditional Statement
Is there a conditional statement that says something like:
if current frame is in its stopped state
then execute the following code.
my problem is that when i press a button that is to got from say frame 1 to 6 of a movie it ends up executing the code on the frames in between.
View Replies !
View Related
Conditional Statement Problem
Having trouble with a conditional statement in Flash, although I really can't see the error.
I'm pulling a color from a text file - file reads '&color=blue'.
In flash I have the following code:
loadVariables("data.txt","_root");
var my_color:Color = new Color(block);
if (color="red") {
my_color.setRGB(0xFF0000); // my_mc turns red
} else if (color="blue") {
my_color.setRGB(0x0000FF); // my_mc turns blue
}
So the data is pulled in, and the color of the MC is changed according to the txt file. The problem is that the color displayed is always the color from the 1st 'if' statement - ie. red even though in this case it should be blue!
Any ideas what is wrong?
Thanks
View Replies !
View Related
Conditional Statement Question
I have been learning action script for a couple of months now, and I have a newbie question. My page loads with the background fading in through a function I created. Next I wanted to either place or animate my contents coming in after that. How do I create a conditional statement to test whether the background has completed coming in and then execute the rest of the contents. I am probably looking at this the wrong way. Any help would be great. Thanks in advance.
View Replies !
View Related
Conditional Statement Problem
Having trouble with a conditional statement in Flash, although I really can't see the error.
I'm pulling a number of variables from a text file -
Code:
&color01=3
&color02=2
&color03=1
etc
In flash I have the following code on frame 1:
Code:
loadVariables("data.txt","_root");
Then I have a number of MCs to color based on the pulled data. I've attached this code to the MCs (where color01 is replaced each time respectively):
Code:
onClipEvent (enterFrame) {
var my_color:Color = new Color(this);
if (color01 == '1') {
my_color.setRGB(0xFF0000);
} else if (color01 == '2') {
my_color.setRGB(0x0000FF);
} else if (color01 == '3') {
my_color.setRGB(0x00FF00);
}
}
So the data is pulled in, and the color of the MC is changed according to the txt file. Doesn't work though - even though I know the variables are being passed to Flash as I have a dynamic text field which displays one of the vars.
Any ideas what I am missing?
Thanks
View Replies !
View Related
Conditional Statement Not Working?
Hi All,
In the code below i can't seem to get the second conditional statement to work.
Any Ideas?
on (press) {
startDrag(this, true);
}
on (release) {
stopDrag();
if (this._droptarget == "/box9") {
_root.corSound.start();
_root.count = _root.count+1;
_root.cnt = _root.count;
this._visible = false;}
tellTarget ("/box9") {
gotoAndStop("pic");
_alpha = 100;
}
if (_root.count == 10 && sisaSec >20){
tellTarget ("/") {gotoAndStop(4)
}
}
else if(_root.count == 10 && sisaSec <20){
tellTarget ("/") {gotoAndStop(3)
}
}
}
View Replies !
View Related
Container Swf Conditional Statement
I'm writing a conditional statement that loads a swf, if a swf is currently loaded into a container movie clip. I'm not having a lot of success. Here's my code
Code:
function Button(event:MouseEvent):void {
if (container_mc("1.swf") = true) {
imageLoader.load(imageRequest);
container_mc.addChild(imageLoader);
}
}
I'd appreciate it if anybody could steer me in the right direction.
View Replies !
View Related
Conditional Statement Wont Work ?
I have four(4) seperate buttons that set a variable
to this when clicked (the buttons work):
soundVibe1 = "yes";
soundVibe2 = "yes";
soundVibe3 = "yes";
soundVibe4 = "yes";
-
Then I have this statement :
if (soundVibe1 == yes && soundVibe2 == yes && soundVibe3 == yes && soundVibe4 == yes) {
trace("all on");
} else {
trace("");
}
-
trace seems to always read "all on" even if I don't hit any buttons, as soon as Flash reads the action the trace "all on" is triggered. What's wrong here ??
Thanks
View Replies !
View Related
Conditional Statement Wont Work
Hi again!! I have a glitch in my code again and this time I've tried EVERYTHING i can think of (Yes, even checking the instance names etc, which i so intelligently did not check last time) so now I'm turning to you guys and gals for some help!!
OK, here's the problem....
I have a variable declared as "F1"on the main timeline which is intented to hold a simple true or false value so i can calculate the number of correct answers to a basic drag and drop game.
THE FIRST METHOD: I originally tried to store the values in a variable called "score" which would basically increment whenever a word was dropped in the right place. BUT this caused a problem: if they picked the word up off this correct spot and then dropped it back in the same spot again the score increments once more!! so, technically if the player is not sure of the answer and drops the word on this spot 3 or 4 times, the score increments that many times :S this meant i could have 22 out of 20 answers correct!!
SO........I am trying this other method which will store a true or false value if the correct answer is in the right place and then calculate the number of correct answers based on the number of variables which hold the "true" value.
The code I am using to check this is placed on an actions MC:
Code:
if (_root.Fword1._x == _root.Mum._x && _root.Fword2._y == _root.Mum._y) {
F1 = true;
trace("TRUE");
} else {
F1 = false;
trace("FALSE");
}
This is the second part of the code placed on a button which just adds one to the score variable if the answer is correct.
Code:
if (_root.F1 == true) {
_root.score++
}
BUT, it isn't recognising the first part of code for some reason. I have placed a dynamic test field on the stage to test this out and even try tracing it whilst i am playing the game but it clearly isn't working. Can someone please help, since i have wasted so much time fiddling with this one problem and I'm SOOOOO close to completing it!!
View Replies !
View Related
Conditional Statement Alpha External SWF
I am launching an external mc, and setting the parent movie's visibilty to _alpha = 35; (works great)
But then I want to set the parent's visibility back to _alpha = 100; when the external mc (Level 2) is clicked off the stage.
I have tried several ways, then thought about creating a conditional statment. My syntax is wrong. Wondering if this can be acheived with a properly written conditional statement, or if there is a better way?
Thanks!
Code:
// load the external SWF "Capt_Amer_B1.swf" into Level 2
on(press) {
loadMovieNum("Capt_Amer_B1.swf", 2);
// set the root, Level 0 alpha to 35
_level0._alpha = 35;
}
// bad attempt to set Level 0 visiblity back to
//alpha 100 after releasing the Level 2 external SWF
on(release) {
if (_level2 = ._visible = true) {
_level0._alpha = 35;
} else {
_level2 = ._visible = false;
_level0._alpha = 100;
}
View Replies !
View Related
Help Needed Writing A Conditional Statement...
Hi world...
does anyone out there know how help out with this...I'm stumped
I have 2 input text boxes, one with the variable name "boxA" and one with the variable name "boxB" I have put a blank space into those input boxes and when the user hits the "Hit OK when you're ready" button , if they have not entered anything into either of those boxes... In other words if either boxA or boxB or both, contain a blank space then the "hit OK when you're ready" button does nothing, otherwise the said button navigates to another frame in the timeline....
cheeeeers
View Replies !
View Related
Conditional Statement Between Two Flash Files
Hi,
I have one flash file (1) with a movie that I need to control with a checkbox controler in a separate flash file (2) located in the same directory on a domain. I know this is a conditional statement on the first file (1) but I need to know what the script would look like.
Thanks
View Replies !
View Related
Using Type Input In Conditional Statement
If the user types "ball" in the input textfield, instance name: name_txt, I want to move to the next frame and stop. Can somebody tell me, what I am doing wrong here? Thank you!
submit_btn.addEventListener(MouseEvent.CLICK, onClick);
function onClick(event:MouseEvent):void
{
if(name_txt.text == "ball")
{
gotoAndStop(2);
}
}
View Replies !
View Related
Using Type Input In Conditional Statement
If the user types "ball" in the input textfield, instance name: name_txt, I want to move to the next frame and stop. Can somebody tell me, what I am doing wrong here? Thank you!
submit_btn.addEventListener(MouseEvent.CLICK, onClick);
function onClick(event:MouseEvent):void
{
if(name_txt.text == "ball")
{
gotoAndStop(2);
}
}
View Replies !
View Related
How To Make A Conditional RemoveChild Statement?
Okay, I'm pretty sure this is a really dumb question with an easy answer, but please bear with me...
I have an application in which the user is putting clothes on a doll and if the user puts one shirt on the doll, but then chooses a different shirt, I want the original shirt to unload. I tried just putting a 'removeChild' within each shirt function, but predictably, if the user never placed one of the other shirts on the doll, then Flash gives an error: "ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller."
I know there should be a conditional statement to remove the Child only if it is present, but I don't know how to have it check for its presence.
Here is the sample code:
function blueShirt (event:MouseEvent):void {
mainStage_mc.addChild(BlueShirt);
BlueShirt.x = -85.5;
BlueShirt.y = -156.7;
}
function tankTop (event:MouseEvent):void {
mainStage_mc.addChild(TankTop);
TankTop.x = -55.5;
TankTop.y = -156;
}
Thanks for any help!
View Replies !
View Related
Simple Conditional Statement Problem?
I want to check a variable for "true" or "false" and based on which, go to a particular frame of a MC. What I have below is failing miserably. What am I doing wrong?
PHP Code:
if(_root.IsLoggedIn = "true") {
_root.favorites.gotoAndStop("trueLog");
} else {
};
if(_root.IsLoggedIn = "false") {
_root.favorites.gotoAndStop("falseLog");
} else {
};
View Replies !
View Related
Using Type Input In Conditional Statement
If the user types "ball" in the input textfield, instance name: name_txt, I want to move to the next frame and stop. Can somebody tell me, what I am doing wrong here? Thank you!
submit_btn.addEventListener(MouseEvent.CLICK, onClick);
function onClick(event:MouseEvent):void
{
if(name_txt.text == "ball")
{
gotoAndStop(2);
}
}
View Replies !
View Related
|