Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




If Statement Issues



I'm not sure how to go about this in this existing code. At the end you'll see 6 words will display, and if there is more than 6 then any more words go on another line. So as to not have it look strange if there are 7 words (6 on first line and 1 under it) is it possible to have the code split the words like 4 on top, 3 on bottom. Maybe something like "if more than 6 words, line break after 4 words instead" or something like that?

ActionScript Code:
if (lettercount == 0) {    i = 1;    usedwords[nameindexednmbr[i]]++;    if (usedwords[nameindexednmbr[i]]>3) {        usedwords[nameindexednmbr[i]] = 1;    }    wordfadeadj.adjwords = adjective[babygender][nameindexednmbr[i]][usedwords[nameindexednmbr[i]]];} else {    for (i=1; i<lettercount+2; i++) {        usedwords[nameindexednmbr[i]]++;        if (usedwords[nameindexednmbr[i]]>3) {            usedwords[nameindexednmbr[i]] = 1;        }        ///start of my fix        //this doesn't even trace out        if ([usedwords[nameindexednmbr[i]]] == lettercount+1){            trace("this is the last word");        }        trace([usedwords[nameindexednmbr[i]]]);        trace(lettercount+1);        /////////end of my fix        wordfadeadj.adjwords = wordfadeadj.adjwords+adjective[babygender][nameindexednmbr[i]][usedwords[nameindexednmbr[i]]];        if ((i/6) == Math.floor(i/6)) {            // if i is evenly divisible by 5 then i=5/10/15/20/25 or 30, which means we're at the end of a line            // so we add a lf, otherwise add a bullet            wordfadeadj.adjwords = wordfadeadj.adjwords+"";        }         else {            //here is where we add the bullet between words (only works with font that renders bullet character)            //wordfadeadj.adjwords = wordfadeadj.adjwords+" • ";            // if it isn't the last word, add a bullet after it            if (i < lettercount) { wordfadeadj.adjwords = wordfadeadj.adjwords+" • "; }        }    }}



KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 05-14-2007, 04:16 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

If Statement Issues
I have a timer set up.. basically on mouse press.. start the timer .... now I want three different things to happenedepending on when the mouse is released... however if I release it early (where the "fall" trace is to appear.. i get "fall" and "not big enough"

I know im not using the if statement correctly.. can anyone give me some input?

thanks


code:
name.onRelease = function(){
if (this.energy < 0.19){
trace("fall");
}
if (2.0 > this.energy > 0.1){
trace("not big enough");
}
if (this.energy > 0.9){
trace("WOOT!");
}


}

If Statement Issues
hi!

well i've got a huge problem.

i've been setting a variable to be able to jump to a specific part of a flash based webpage via html but i have problems when the specific parts i want to load are not on the main timeline.

the code i've got (on the first frame of the main timeline) is:

if(gotolinki == undefined)
{
trace("gotolinki ist undefined");

}
else
{
if(gotolinki == "home")
{
_root.gotoAndPlay(2);
}
if(gotolinki =="scan")
{
_root.gotoAndPlay(3);
}
if(gotolinki =="newmedia")
{
_root.gotoAndPlay(4);
_root.mc_navigation_services.gotoAndPlay(1);
}
if(gotolinki =="fullservice")
{
_root.gotoAndPlay(4);
_root.mc_navigation_services.gotoAndPlay(2);
_root.container.services_cont_intern.gotoAndStop(2 );
}

the examples "home" and "scan" work fine because they sit on the main timeline but for example fullservice that consists of different movieclips all nested on frame 4 of the main timeline doesn't work.

has anyone got an idea of how the right code would be to be able to access the specific movieclips on the _root timeline using this if statement and the variable?

thanks lots!

[F8] If Statement Issues
I have one button on stage.

The idea: The button is pressed, movie clip slides in.

If the movie clip is already there, the button slides it out.

Pretty simple but I'm having trouble since I'm new to if statements and actually tweening with actionscript.

So I thought this process would make sense. If it's x = 612 tween it to 412, if it's 412 tween it to 612. I may be way off.

import mx.transitions.Tween;

var mc_xvalue = getProperty(_root.sb_prop1,_x);

prop_but1.onRelease = function(){
if (mc_xvalue == 612){
var tw:Tween = new Tween(_root.sb_prop1,"_x", Strong.easeInOut, _root.sb_prop1._x, 412, .25, true) ;
} else {
var tw:Tween = new Tween(_root.sb_prop1,"_x", Strong.easeInOut, _root.sb_prop1._x, 612, .25, true) ;
}
}

If anyone can help, thank you in advance.

If Statement Issues
Im having an issue with this code. When I dont use the if statement the code works perfectly, when I wrap it with the if statement it simply stops my movie and doesnt let it continue down the timeline. Ive debugged the code and found that _global.looptest is at 1 and then when the timeline reaches the code it changes to 0. Any help would be appreciated.


Code:

if (_global.looptest == 1)
{

stop();
var nInterval = setInterval(Play, 3000);
function Play()
{
clearInterval(nInterval);
gotoAndPlay(_currentframe+1);
}
}
_global.looptest = 0;

"if" Statement Issues
hi everyone. i am trying to make a site that uses NO KEYFRAME TWEENING so i am relying on actionscript to do all the tweening for me. however, it's hard for me to keep everything from happening at once.

here is the site:
http://therepublic.com/ftp/hoops/hoops.html

as you can see, after the preloader loads, everything all comes in at once, and this causes the frame rate to decline. so i want to stagger the actions a little so that it doesn't put so much load on the processor.

i've tried fixing this with "if" statments. for example, i'll ask it not to load the players until the overhead control panel has moved all the way to the right, but none of my "if" scripts seem to work. here's an example of how i've been writing them:

if (loader_mc._x == 0) {
new Tween(eg_mc.flash_mc, "_alpha", Regular.easeOut, 100, 0, 1, true);
new Tween(ng_mc.flash_mc, "_alpha", Regular.easeOut, 100, 0, 1, true);
new Tween(hg_mc.flash_mc, "_alpha", Regular.easeOut, 100, 0, 1, true);
}

eg_mc, ng_mc, and hg_mc are the three girl players that flash in. flash_mc is a movie clip inside each of the girl movie clips that contains the flash look. the loader_mc contains the swf for the overhead controller.

can anyone tell me why these "if" scripts aren't working?

THANKS!

Loading Data From XMl File And Uses It To Run An If Statement. If Statement Fails.
[Flash CS3 (Flash 8 available as well)]
[Actionscript V2 (AS3 Not available for this project. End result must be in AS2. Plus I haven't learned AS3 yet)]

Hi

Sorry about running two posts so close together, but I couldn't change the other one to reflect the changes I've made in my problem.

The 1st post dealt with my theory that my IF statement wasn't written correctly, and so failed. But I've since disproved that.

Okay here is the situation.
I isolated elements from a larger app that I'm putting together and the problem still followed.
The Flash movie contains 2 Text files, one Component button, and 1 component checkbox.
The purpose of the application is to load an XML file(works)
Populate 2 text fields with information from the XML file(works)
Compare the two text fields, if they contain the same information then the checkbox, via AS is told to be selected. (Heres the problem);

Heres the code:

Code:
runCode_btn.onPress = function() {

data_xml = new XML();
data_xml.ignoreWhite = true;
data_xml.onLoad = function(success) {
if (success) {
//point to the first node with information
var track_xml = data_xml.firstChild;
//loop through each node
while (track_xml != null) {
//print out each node
test1 = track_xml.toString();
//point to the next node
track_xml = track_xml.nextSibling;

//Runs my code

//Define the contents of two text fields located in the movie
textOne = data_xml.firstChild.childNodes[3].firstChild;
textTwo = data_xml.firstChild.childNodes[5].firstChild;
trace("data_xml.firstChild.childNodes[3].firstChild = " + data_xml.firstChild.childNodes[3].firstChild);
trace("data_xml.firstChild.childNodes[5].firstChild = " + data_xml.firstChild.childNodes[5].firstChild);
/*dummyYes = data_xml.firstChild.childNodes[5].firstChild;
dummyNo = data_xml.firstChild.childNodes[6].firstChild;
dummyMaybeEmail = data_xml.firstChild.childNodes[3].firstChild;
dummyMaybeFax = data_xml.firstChild.childNodes[4].firstChild;*/

//Checks between the two text fields for a match
if (textOne == textTwo) {
trace("It is selected!" + textOne + " " + textTwo);
check_fax.selected = true;
} else {
trace("Ir is NOT selected!" + textOne + " " + textTwo);
check_fax.selected = false;
};


}
} else {
trace("error reading file");
}

delete data_xml;

};

data_xml.load("XML/dummy2 - email.xml");

};
After you read the code, you'll have noticed the trace commands I stuck in there.
They send this to the output panel:

Code:
data_xml.firstChild.childNodes[3].firstChild = 1
data_xml.firstChild.childNodes[5].firstChild = 1
Ir is NOT selected!1 1
So as far as I can see, it reads the XML file with no problems, it loads the text fields with no problem. But for some reason the IF statement refuses to recognize that both the XML nodes contain the same information.

If I alter the code like so:

Code:
textOne = 1;
textTwo = 1;
Then the IF statement works. It sees that the two text fields are identical in content, and the checkbox is selected.

So whats wrong with the Data from the XML file?
I haven't a clue.
I tried converting from a string to a Numeral using:

Code:
newText = Number(textOne);
But that didn't work, it just produced "NaN" when traced.
I tried populating the XML file with text versus numbers, still no luck.
What came from the trace:

Code:
data_xml.firstChild.childNodes[3].firstChild = hi
data_xml.firstChild.childNodes[5].firstChild = hi
Ir is NOT selected!hi hi
The idea behind this app is that its an electronic form. The user fills it out, the information is then sent to a newly created XML file, months later the open the XML file in flash, and Flash fills out text fields and check and or unchecks Checkboxes based on the XML data.
CheckBoxes are mandatory.
But I don't see how I'll be able to use them if i can't create and condition statements based on the loaded Data.

I'd really appreciate some help and suggestions with this, I think I'm out of ideas.

Thanks

-Lem

Problem With Continue Statement And Label Statement
What am I doing wrong?

ActionScript Code:
var a = {
    a:[1,2,3,4,5,6,7,8,9,0],
    b:[1,2,3,4,5,6,7,8,9,0],
    c:[1,2,3,4,5,6,7,8,9,0],
    d:[1,2,3,4,5,6,7,8,9,0],
    e:[1,2,3,4,5,6,7,8,9,0],
    f:[1,2,3,4,5,6,7,8,9,0],
    g:[1,2,3,4,5,6,7,8,9,0]
}

outerLoop: for(var i in a){
    trace(i);
    for(var j in a[i]){
        trace(' '+j);
        continue outerLoop;
    }
}


Quote:




1039: Target of continue statement was not found.

Converting 'If Else' Statement To A 'switch' Statement
I am attempting to convert the following If statement to a Switch statement and I'm unclear as to the details of the execution of it. If someone could help me with this I would be very grateful. Here is the If statement followed by the shell of my attempted switch statement. TIA.

var spotOne:Boolean = true;
var spotTwo:Boolean = false;
var spotThree:Boolean = false;
var spotFour:Boolean = false;

btn.onRelease = function() {
f (spotOne) {
ball.slideTo(450, 100, 1);
spotOne = false;
spotTwo = true;
} else if (spotTwo) {
ball.slideTo(450, 150, .5);
spotTwo = false;
spotThree = true;
} else if (spotThree) {
ball.slideTo(100, 150, 1);
spotThree = false;
spotFour = true;
} else {
ball.slideTo(100, 100, 1);
spotFour = false;
spotOne = true;
}
};
---------------------------------
(attempt at conversion to switch)

var spotOne:Boolean = true;
var spotTwo:Boolean = false;
var spotThree:Boolean = false;
var spotFour:Boolean = false;

btn.onRelease = function() {
var location:Number = ?

switch(location) {
case spotOne:
ball.slideTo(450, 100, 1);
spotOne = false;
spotTwo = true;
break;
case spotTwo:
ball.slideTo(450, 150, .5);
spotTwo = false;
spotThree = true;
break;
case spotThree:
ball.slideTo(100, 150, 1);
spotThree = false;
spotFour = true;
break;
case spotFour:
ball.slideTo(100, 100, 1);
spotFour = false;
spotOne = true;
break;
}

Loading Movie IsSues And Other Issues
i have a main movie and i when an name is cliked on the navigation bar i would like the new movie to load. so there are seeral issues i am having..

1. i am not sure if i am doing this correctly - i am trying to use tutorials.
2. when i load the "services" movie my text will not show up either.
3. i need help by some one that has a lot will be nice i am in a learning phase

CAN SOME ONE PLEAE HELP

THIS IS THE LINK - GIV EIT AINUTE I HAVE NOT PUT ANY PRELOADERS UP YES. I CAN SEND THE FLA FILES FOR MORE HELP

Browswer Size Issues + New "FlashObject" Detection Kit Sizing Issues
Hi,

After a few years of trying to learn Flash there is one aspect that really still remains a grey area to. What size to publish a movie.

Do I look to make my movies a set size on publishing – by using “Match Movie” & if so what should that set size be – 800 x 600?

I know of 3 other ways to get round the browser size issue

1.) Use the “Stage Object” in conjunction with onResize to allow some clips to fill a screen while keeping others to a set size.
2.) Ascertain a users browsers size & direct them to an appropriate version of your site.
3.) Scale your movie according to an ascertained browser size so if the movie was designed @ 1020 x 760 & the user has an 800 x 600 you scale the main movie accordingly using x & y scale.

The problem has been somewhat complicated for me by the introduction of Geoff Stearns brilliant “FlashObject” detection kit. With that you have to specify the size of the element that the Flash movie will load into & also set a fixed size for the Flash movie. From what I can see this will cut out the option of publishing a movie @ 100% & resizing or not resizing using the stage object.

Could someone please advise me of what is best practice as far as sizing is concerned.

Need A Simple If/else Statement, SOSneed A Simple If/else Statement, SOS
hi, i'm a new learner.

currently, doing an exercise on button.
i want to do a navigation button like
www.fendi.com (pls refer, thx ; )
where button that onPress it will remain,
the rest not clicked, will fade out.

i think i need a right if/else statement.
i've tried few, but still not working.

i have my flash file attached.
hope some experts here can help.

hear from you guys soon, thanks

Loading Issues & FLV Issues
Sooo, I've finally, after fours days (including two on the weekend), managed to build a .swf that will play FLVs within the Crisp Template....however, I have come across two problems:

1. the FLVs continue to play when you click on other menu items. How can I stop the FLV from playing with a command from the _root timeline to a timeline in a completely different swf? and where would that code be placed within the menu button actionscript?

2. I'm using Actionscript 2.0 and the FLV Behaviors "Set Video List" option. The FLVs are loaded dynamically, but I only want them to load upon request, otherwise it takes 10 minutes to load the page due to the number/volume of FLVs. Is there a way to code the "ready" event handler so that it doesn't fully load? The code I currently have in is:
// Set a 'ready' event handler to load the videos
videos.ready = function( evt:Object ):Void
{
if(!this.loaded){
this.loaded = true;
for( var n=1; n<this.list.length; n++ ){
if( videos.list[n].indexOf(".flv") != -1 ){
m.activeVideoPlayerIndex = n;
m.contentPath = videos.list[n];
this.length++;
}
}
m.activeVideoPlayerIndex = 0;
}
}
m.addEventListener("ready",videos);

// End Set Videos Behavior

What needs to change to make this happen?

Please see: http://www.kimiporter.com/hydeparktest/ to witness both errors in action

Like Statement
Is there a way to do a "like" statement like an ASP database record seatch?

What i need to do is find a number in a list of number that is returned from my asp. The value list looks like this..

&Values=0|1||2||3||4||5||6||7||8||9|10|

What i want it to do is if |3| is found in that string then it will show a movie clip. If is not found in the string it will not show the movie clip. Is there away to search a string for a value?

If Statement
Hi,
I have a problem (see the files I included).
What do I want: when somebody presses on the left arrow button that the timeline goes to frame number 10.
In frame 3 (in the main timeline) I wrote:

If ("/:film1richting"=-2)
Go to and Stop (10)
Else
Go to and Play (2)
End If

This doesn't work. I don't know why because the variable is -2 (see the arrowleft button actionscript)when somebody presses the left arrow button. I don't want to solve this problem by writing a simple actionscript in the left arrow button: On release go to frame 10. But I want to use the if statement in frame 3. Does anybody know what I must do?

http://members.home.nl/u-p/movement.swf
http://members.home.nl/u-p/movement.fla

Thanks
[Edited by U.P! on 08-21-2001 at 07:32 AM]

With Statement
I could really use some help here.

I am trying to build a inverted tree. With one object at
the top and then on the next level down there will be 2
objects and so on and so on. I've decided to use
movieclips. I made a movieclip and set linkage.
it's name is "node". If I am doing this dynamically
using the attachmovie() I have to assign a name and a level,
so I do that. Now for the location I have decided to use
the "with", because I have dynamically attached the movie
I do not know what the name is, so I try to build a
name string and pass it to the "with" statement. this
does not work.

here is the code, it is start when you hit a button.

ndx = 1;
powersof = 1;
xmove = 25;
ymove = 25;
index = 1;
count = 1;
if (_root.TextField6 == "anatomy") {
while (index<=_root.anatomy.length) {
if (index == 1) {level_movie = "node_"+ndx;
_root.attachmovie("node", level_movie, ndx);
currentmovie = "_root." + level_movie;
with (currentmovie) {
_x = 138;
_y = 90;
ndx++;
}
} else {
}
while (count<=Math.pow(2, index)) {
level_movie = "node_"+ndx;
_root.attachmovie("node", level_movie, ndx);
currentmovie = "_root." + level_movie;
with (currentmovie) {
_x = 138+(xmove*count);
_y = 90;
ndx++;
}

count++;
}
count = 1;
index = index+Math.pow(2, powersof);
powersof++;
}
}
stop ();

I really would appreciate some help.
thanks all
my email is rbrumback@imedlink.net

If Statement
Hi guys
I think this is very simple for you but I need it
I'm trying to make a small game and I have 3 counters
win, lost and tries where tries =8 and win=0 and lost=0
it's like this

on (release) {
if (variable1==variable2){
tries--
win++
} else {
tries--
lost++
}
}

Now I want to tell the actionscript to loop until tries =0 and then go to frame 20
that's all
I know it's very easy but...
thanks in advance

If/else Statement Help
Okay guys,

I managed to figure out my other problems ... now I have a new one ...

I'm fairly new to if/else statements so I need some help with this one ...

here's what i'm doing ...

I have a series of MC's that are draggable and have target areas (meaning they will snap into position once dragged into the target area) ... now what I need to do is (or at least I think) write an if/else statement that says 'if all mc's are dropped into the target area go to and play xxx' ... how do i do this ...

help appreciated as always.
eg

If/else Statement - HELP
Should be a simple question. How do I do this correctly in actionscript?

If (_parent movie = frame2) {
gotoandPlay (frame1)


I don't really even need an else. I want it to keep going till it reaches frame2 of the parent movie.

Please Help Me With An If Statement
i'm not that big of an actionscripter, but i'm trying this thing, basically, its when u click a button it plays a certain frame within a movieclip, depending on where what frame the movie clip is already in, have a look at this::

on (press) {
if (mens_sub_buttons = (1)) {
tellTarget ("mens_sub_buttons") {
gotoAndPlay (2);
}
} else {
tellTarget ("mens_sub_buttons") {
gotoAndPlay (16);
}
}
}

if its at frame 1 i want it to play frame 2 , but if its at anything else i want it to play number 16

but it doesnt work! any ideas??

thanks alot!

If, Then Statement
I have created a drag and drop application, and now I want to add a few rules. I have assigned values to the different MCs and I want to create an If, then statement that will add the movie clips as they are dropped into the target area. So when a certain value is achieved it will not let any other objects to be dragged in until pieces are taken away. Can someone help me out, I'm not sure where to start.

Can Someone Help Me With An If Statement
I am having some brain blockage regarding an if statement. The idea is simple if a score is x then the variable is y, but if the score is w or z the variable is b. Can someone help. There are 17 layers to this statement.

If Statement
I have a series of buttons that when pressed open up a movie clip inside another movie. I am using this for a visual comparison of 2 different materials, from which there are 15 to chose from. Each of the 15 materials has a button for which I have built a function. Upon press of button x, the chosen material opens in "picture frame" movie (currently opens in picFrame2 only). How I want it to work: if there is already a picture in picFrame1, I want the second choice to fill the 2nd picFrame, if not, in picFrame1. Null doesn't work, any suggestions on what will?
function showMaterial (movieName, thisClip) {
if (_root.picFrame1 == null) {
_root.picFrame1.attachMovie(movieName, thisClip, 1);
} else {
_root.picFrame2.attachMovie(movieName, thisClip, 1);
}
}
Thanks in advance

If Statement
ok here is what i have

on (release) {
value1 = A;
value2 = B;
value3 = C;
value4 = D;
value5 = E;
value6 = F;
value7 = G;
value8 = H;
value1 = Number(value4)+Number(value5)+Number(value7)+Numbe r(value9);
a = value1;
value3 = Number(value4)+Number(value5)+Number(value6)+Numbe r(value11);
C = value3;
value2 = Number(value5)+Number(value6)+Number(value7)+Numbe r(value10);
B = value2;
if (value4 == Number(value3)-(Number(value5)+Number(value6)+Number(value11)) or value4 == Number(value1)-(Number(value5)+Number(value7)+Number(value9))) {
d = value4;
}
if (value5 == Number(value1)-(Number(value4)+Number(value7)+Number(value9)) or value5 == Number(value2)-(Number(value6)+Number(value7)+Number(value10)) or value5 == Number(value3)-(Number(value4)+Number(value6)+Number(value11))) {
e = value5;
}
if (value6 == Number(value3)-(Number(value5)+Number(value4)+Number(value11)) or value6 == Number(value2)-(Number(value5)+Number(value7)+Number(value10))) {
f = value6;
}
if (value7 == Number(value1)-(Number(value5)+Number(value4)+Number(value9)) or value7 == Number(value2)-(Number(value5)+Number(value6)+Number(value10))) {
g = value7;
}
if (value12 == Number(value8)-(Number(value1)+Number(value2)+Number(value3)+Numb er(value4)+Number(value5)+Number(value6)+Number(va lue7))) {
h1 = value12;
}
if (value9 == Number(value1)-(Number(value4)+Number(value5)+Number(value7))) {
a1 = value9;
}
if (value10 == Number(value2)-(Number(value5)+Number(value6)+Number(value7))) {
b1 = value10;
}
if (value11 == Number(value3)-(Number(value4)+Number(value5)+Number(value6))) {
c1 = value11;
}
}


Now what I am trying to find out is if i can use the if statements like i have.. Since there is many ways to find out the different variables i need to use the or statement so it checks to make sure that the variable is equal to each other, so it dosnt change the variables that have already been typed in...

Else Not In If Statement
Does anyone know how the else handler is not within the if statement? Error Flash seems to want to give me.

if (clickSpot_x ne _root.beetle._xmouse)
{_root.beetle.play();
else
if (clickSpot_x = _root.beetle._xmouse)
{_root.beetle.stop();
}
}

Thanks a million!

'for' Statement
12 eggs in a carton
when you rollover the first egg the other 11 should disappear.

do i have a syntax prob?


on (rollOver) {
for (i = 2; i <= 12; i++){
_parent.egg[i]._alpha=0;
}
}



I think i do ;(

Help On If Statement
here is the actionscript for pong game


main scene with one frame:

player1 = 0
if (player1 = 10){
gotoAndPlay("otherscene", 1)
}
stop();


ball engine (when it pass the end of the "table")

player1 = player1 + 1



all I do is skip this game to "otherscene"
need help on this actionscript. I can't find what's wrong. I need it soon because I need it done for final project

If Statement With &&
Is something wrong here?

if ((_root.current == "buzz") && (root.newPress== "company")){
gotoAndPlay("3");

}else{
gotoAndStop(1);
}

one of them works on its own, but when the && is in there, it doesn't.

thnx

Why Is My IF Statement Ignored?
Something's wrong... I've puzzled this over for days now and can't seem to figure out what went wrong.

Here's my code:

temp = 1;
temprandom = (Math.random()*100);

if (car[temp] == 0)
{
if (temprandom < 10)
{
car[temp] = 1;
}
}

So essentially, here's what I'm having happen.

I'm working with a variable in a declared array Car. If car[1]==0, there's a 10% chance that it'll become 1, otherwise it'll stay at 0. But the problem is the code seems to be ignoring my Math.random command. I did a trace... so far example, temprandom = 42. Yet when it comes to the if statement if (42 < 10), which it's not, it'll still increment car[temp] up to 1. Regardless of whether or not temprandom is higher or lower than 10, it always increments.

Any idea why it's doing this?

If, Else & Var Statement Help...Please?
Ok, I'll try to explain this easily.....First check out my site so you can get a feeling for what I'm talking about.

-->>http://www.dynamai.net/FLASH/main.swf *Go to the Portfolio link.

My problem is that I want an info button to be apparent only for certain pieces of art. The portfolio section of the site consists of 1 loaded movie clip (square buttons on left) and the .jpg images which are loaded as the user clicks on the individual boxes. The main movie starts out with:

_root.mc.loadMovie(image);

which sets an variable which all other .jpg files are loaded into as the user clicks the appropriate boxes.

on (release) {
_root.image = "http://www.dynamai.net/images/artwork/digital/abstract.jpg";

My thought was to have the info button residing on the stage and as the user clicked it would go through this statement:

on (rollOver) {
if (image = "http://www.dynamai.net/images/artwork/traditional/man.jpg" ) {
tellTarget ("info") {
gotoAndStop("Man");
}
} else {
tellTarget ("info") {
gotoAndStop(1);
}
}
}

If these images matched then the Info text for that picture would appear. For some reason it seems that it should work, but I know I've screwed up somewhere simple.

If you need to look at the fla let me know. I would realy appreciate any help... Thanks a lot!!

If/then Statement
trying to get a basic if/then statement to work: someone help out?

on mc

Code:
onClipEvent(load){

bag1 = true;
bag2 = true;
}
onClipEvent (enterFrame){

if (bag1==false){
_root.bag2._visible = 0;


}else if (bag2==false){
_root.bag1._visible = 0;

}
}


on button

Code:
on(press){

_root.bag1==false;
trace("false");

}



http://www.sphosting.com/furrysnake/...l_if_then.html
http://www.sphosting.com/furrysnake/...el_if_then.fla

If Statement
I'm probably going about this all wrong but it's the only way I can figure to do it, if it's possible. What I want to do is find out what the movie is on level1 and do something on that condition. Here is what I have for coding but it's not working. Maybe someone can tell me what's wrong with my coding or if I'm going about this all wrong?

on (release) {
if (_level1="downloads.swf") {
loadMovieNum ("images/downunload.swf", 1);
} else {
unloadMovieNum (1);
}
}

This is an action assigned to a button. All is does is unload the movie so it's not seeing downloads.swf on level1 even though it's there and I'm clueless on what I'm doing wrong. Is it possible to do it this way? Thanks for the help in advance

Help With If/Else Statement
Hi,

I'm tryint to check on my root timeline if on the time line of my MC (blueGreen) has reached a certain point ("finished") then I want to proceed to "melt" on the MC timeline.

this is what i have, but I know the condition statment in the if part is not correct.

if(blueGreen=="finished")
with(blueGreen)
gotoAndPlay("melt")

Else(gotoAndStop(_root.("waiting")))

please help i know my code is HORRIBLE!

If Then Statement Help
I need help. I'm not a action script guru. I have 5 buttons. one character that is wearing sunglasses. What I want is when you click the red button, the sunglasses turn red, blue button they turn blue, etc...
I want this to stay this way throughout the entire movie.
I think this can be done by if then statements and setting the visibility, but I don't know the code. Can anyone help. In layman's terms if possible.

Thanks,
Tom

'for' Statement
this works:

_parent._parent.slide1.magnify.gotoAndStop(1);
_parent._parent.slide2.magnify.gotoAndStop(1);
_parent._parent.slide3.magnify.gotoAndStop(1);

but this doesn't:

for (i=0;i<20;i++){
_parent._parent.slide[i].magnify.gotoAndStop(1);
}


what am i doing wrong??

If Statement ( I Think)
Hello everyone. I need to figure out a way to code the following pseudo code:

if the user hasnt moved the mouse in 30 seconds and there is no movie loaded in level 10, _root.gotoAndPlay(1);

this is for a presentation that passers by would play with. Is this possible to do? Any help is greatly appreciated.

If Statement
Hello everyone. I have an MC that has a open and close type of animation. When the user clicks on it it opens and currently they have to click again to close it. What I want to do is have a script say:

if the MC is open and the user's mouse hasnt been in the vicinity (x and y) for 30 seconds then the MC should close.


anyone know how to script this? Any help is greatly appreciated.

If Statement
Happy New Year!

ok i need some help.
i need a action for a button what tells a movie
that if it is on frame 10 it plays and if it is not
it dosent play
will it be somethink like this

_root.submen if (frameNum>10)
play

If Statement
I am trying to use an If Statement to load a movie clip depending on the answer typed in an input box.

I have the "correct" movie clip placed on frame 3 and the "incorrect" movie clip on frame 2 and the following actionscrpt attached to my button.


on (release) {
if (ans=125) {
tellTarget (_root.correct) {
gotoAndPlay(3);
}
} else {
tellTarget (_root.incorrect) {
gotoAndPlay(2);
}
}
}

But when I run the script it always come up correct even if ans = 55 for example.

Can you help?

Cheers

James

If Statement
k i have this 3d spinning thing here. i'm trying to make each word be a link. i'm doing this by nesting buttons in the MCs (the MC's being the words), however, in frame 3 of the script layer there is a script saying:
Code:
gotoandplay (2);
frame 2 being the rotation of the array that has been used, this gotoandplay bit seems to be thwarting any such mouse scripts i try to put onto the buttons. from reading a few tutorials it seems that i could possibly use an IF to get around this. what i'm wanting it to do is basically:

if the afterparty bit is clicked gotoandplay scene 2, 1
else gotoandplay (2)

from what i could gather the script should look something like this:
Code:
if (afterp = 1)
gotoandplay ("afterparty" , 1)
else
gotoandplay (2)
endif
afterp being the instace name of the MC and afterparty being the name of scene 2

however when i add the script i either get scene 2 just comeing up without prompting or the whole thing flashing like crazy, i've tried swapping the afterp bit for the name of the nested button and that still doesn't work. anyone have any ideas?

cheers, squid.

If Statement
Hi...

not up on the If statements and wondered if this is possible?

trying to load a new image every time a thumb nail is clicked and want the stroke around the image to only animate once. So if its been animated then stop where it is, otherwise start.

on (press) {
loadMovieNum("flash/imgpop1.swf", 7);
stroke = "flash/imgstroke.swf";
if (stroke>=12) {
tellTarget ("stroke.stop") {
}
} else if (stroke<=2) {
tellTarget ("stroke.gotoAndPlay(3)") {
}
}
}

im trying to say, if the imgstroke.swf is at or after frame 12 then stop. Otherwise if its before or at frame 2 go to and play frame 3.

Can someone clean it up a little?

thanks


cuse

If Not / Else Statement?
is there an "if not" statement in flash,

see i want to achieve:
if object1 is over object2 then (action) but else (do nothing)

ive played about with else statements but it always asks for else if, with which i would have to add if not... the above. that doesnt work.

OR Statement
Why doesn't this work?

// Checks to see what day it is and do the according
if (_level0.themday == "Monday" || "Tuesday" || "Wednesday" || "Thursday" || "Friday") {
gotoAndPlay(3);
} else if (_level0.themday == "Saturday" || "Sunday") {
_level0.melboff = "CLOSED";
gotoAndPlay(1);
}

IF Statement
Hi

I've got an animation (equilizer style) ... when the swf start, the var audioStatus = 1.

A button is place behind the equilizer so when the user click, it stop the animation and set the var audioStatus = 0.

But I want that when the user click again the animation replay.

Here's my script :


Code:
on (release) {
if (audioStatus = 1) {
eq01.stop();
eq02.stop();
eq03.stop();
audioStatus = 0;
}
if (audioStatus = 0) {
eq01.play();
eq02.play();
eq03.play();
audioStatus = 1;
}
}
The problem is that the first time I click on the button to stop the animation, it work well and the var is changing to 0, but when I click again, nothing happen

Please help !!!

If/then Statement Help...
ok. i'm trying to do something... when the user hit's the "right arrow key" the numbers on the screen stop, but when the number stops where it supposed to (ie. 6) then that movieClip will do something different (ie. change of x value) and this would work down the line so that when all the numbers have been stopped at the correct position something else occurs, and so on...

below is the code that i've attempted to use, but it's not working, and my limited experience using if/then statements and clipEvent statements has prevented me from further trouble shooting. i'm using mac osx (10.2.2) flash mx

onClipEvent (keyPress) {
if (this.stop("6")) {
this._x = 529.4;
} else {
this.play();
}
}


hopefully this makes sense, any help, and or advice would be much appreciated. thanks.

Ken

If Statement
how do you make an "if" statement cause a movie clip to play a certain frame if it's at frame 1 and "stop" or "play" at other frames.

Something like:

if(_root.myMovieClip=frame(1)){
play.nextFrame;
}
else{
play();
}

This isn't right but any help would GREATLY appreciated.

If Statement
how do you make an "if" statement cause a movie clip to play a certain frame if it's at frame 1 and "stop" or "play" at other frames.

Something like:

if(_root.myMovieClip=frame(1)){
play.nextFrame;
}
else{
play();
}

This isn't right but any help would GREATLY appreciated.

If Statement
I'm using 'if statements' to detect variables. I've tried just about everything - but I can't seem to get it to work properly. I posted my FLA.
Can anyone help ?
My if statements are on the layer named 'actions'
And the buttons on the stage call the variables.

Thanks.

If..then Statement HELP...
Hi guys:

NEED YOUR HELP!

I am trying to write an if then statement which checks 2 variables at the same time and then the action happens. I am trying to write (psuedo code):

if section eq "portfolio" and section2 eq "commercial" then gotoandplay "commercial".

I have been trying to do this for hours and I can't seem to figure it out! It seems simple enough to me!!!!!!! HELP!!!

Thx in advance!!!!!

IF ELSE Statement - HELP
Hi Everyone,

I’m having problems with using a basic if / else if Flash MX 2004 Pro (also does the Pro version come with the option of using novice actionscript mode instead of the default expert??).

I have created an application that uses screens, I want to be able to change the visibility of each screen depending upon its current state (visible or not), I know how to change the screen visibility:

On(release){
ScreenContact.visible = False
}

But I need to use a if / else statement to determine if the screens visibility value should be set to true or false. Being a vb programmer I would have written it like:

If ScreenContact.visible = true then
ScreenContact.visible = false
Else
ScreenContact.visible = true then
End if

I know that the syntax in Flash is different for example:

If (ScreenContact.visible) {
}

Can anyone help!!

Cheers

Carl

Copyright © 2005-08 www.BigResource.com, All rights reserved