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




If Statment



Hello. I am trying to test if there is something in a dynamic test field. If there is I want to display some information in another dynamic text field. If there is not I dont want to display any thing. How do i do this. I have tried the following

if(_root.txtQty1 != "" || _root.txtQty1 != Null)
{
....
....
....
}
if(_root.txtQty2 != "" || _root.txtQty2 != Null)
{
....
....
}
ect
ect

When i press the button that has this code it loads All the data even if there isnt anything in the txtQty field. is there any way to fix this.

Thanks



Tek-Tips > Adobe(Macromedia): Flash Forum
Posted on: 28 Mar 03 14:42


View Complete Forum Thread with Replies

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

IF Then Statment
I want to be able to use the if then statments in a website. it works fine in the flash browser, but on internet explorer it does not work.

I use this on the button
on (release) {
if (Position1 == "IN") {
if (Position2 == "IN") {
gotoAndPlay ("Movie 7");
}
if (Position2 == "OUT") {
gotoAndPlay ("Movie 3");
}
}
if (Position1 == "OUT") {
if (Position2 == "IN") {
gotoAndPlay ("Movie 8");
}
if (Position2 == "OUT") {
gotoAndPlay ("Movie 4");
}
}
}
It works fine with the flash viewer, but when i see it in ie it goes to the first goto command.
Please help
Please tell me if it is possible for it to work, and if so how thanks a bunch!!

Using OR In A If Statment?
why doesnt this work? (i want it so that if its in frame 1 or 2, it runs the script. )
[code] if (_root._currentframe == 1||2 ) {
//the script when currentframe is 1 or 2
}

If Statment?
Hello,

I have two textboxes and they both have different names. Say the user enters the same number in both textboxes how will I get actionscript to know that the same number is in both textboxes and then to set a value in another text box like this :

code:
if (textbox1 == textbox2){
textbox3 = "Bot text boxes equal the same";
}


Something like that ?

If Statment?
He folks, its been so long since i was here i forgot my username and password, so i had to make a new one

Anyways.
My question is this:
I have a menu system that is faded out and moves up and down.
When the user press somewhere over that menu i will fade it in and sort of 'activate' it. How do i make the movie clip work so that when the user clicks (no matter where in the timeline the animation is)it completes it's animation, and then jump to a set frame number.

hard to explain what i mean. But when a user press ontop of the menu i want the animation to continue until it reaches the last fram, and then act on the User click and jump to a different frame number (that activates the menu)

Plz help me, im getting frustrated

ps im using flash mx 2004

If Statment?
hi, iam having problems with my if statment it seams to ignor the first statments and always just do the last condition even if the statment isnt correct?

heres the code it looks complicated but i have tested all of it using trace and the problem seams to be that its not end if(ing)? is there an eqivulant of this in flash coz that may be the problem.

on (release) {
//this is setting the vars
game = {tileW:30, tileH:30};
game.clip = _root.tiles;
//this food scorer works
if (_root.foodtotal.text>4) {
_root.foodtotal.text = Number(_root.foodtotal.text)-5;
_global.workbut = true;
//from here down is the problem
if (game.clip.queen1._currentframe=1) {
game.clip.queen1.gotoAndPlay(6);
}
if (game.clip.queen1._currentframe=2) {
game.clip.queen1.gotoAndPlay(18);
}
if (game.clip.queen1._currentframe=4) {
game.clip.queen1.gotoAndPlay(30);
}
//it just goes to frame 42 regardless?
if (game.clip.queen1._currentframe=5) {
game.clip.queen1.gotoAndPlay(42);
}
}
}

If Statment Help Please
Hi Guys, Can someone have a look at this bit of code below please. What I am trying to do is - I have several movies on the stage which are sliding menu buttons. They are all the same. They start and stop on frame one then from frame 2 there is a tween to slide the menu item out to frame 10. It then stops there and frame 11 to 21 are a tween where it slides back. What I am doing is checking what frame the other movies are on and shrinking or expanding depending. This is a snippet of teh button code, I havent put it all in as I just need to check the syntax of the statment. Any ideas why it doesnt work? Have I written it wrongly? Sorry I am new to this action script

the buttons on frames 1 and 10 have code as these are the only frames it stops

Thanks in advance
Alan

code:
if (_root["promos"] ==(1)) { //promos is shrunk
_root["promos"].gotoAndPlay(11); // expand it
}
else { // otherwise leave it where it is
_root["promos"].gotoAndStop(1);
}


EDIT: Added as tags to code. - jbum

If Statment?
Hi.

I would like to use an IF statement but am not sure of the syntax.

This is what I would like:


on (release) {
tellTarget ("_root.menu_sub01") {
gotoAndPlay(2);
}
}
IF _root.menu_sub02 at frame 16

on (release) {
tellTarget ("_root.menu_sub02") {
gotoAndPlay(16);
}
}

IF NOT then do nothing.


If anyone could re-write this for me it would be great.

Thanks - Joe

If Then Statment Help
Ok I am a bit of a noob at this stuff but i know some basic code. I need to make a bar that has several items on it and when i click on one the previous one will fade out. How do i get it so that it knows which one it's ok and make it goto the scene it needs to go to using action script.

If Statment ?
// The Button

on (press){
_root.L_size = 1;
}

// The code to size a MC.

onClipEvent (load){
_root.L_size = 0;
}

onClipEvent (mouseMove){
if (_root.L_size){
if (_xmouse < _xmouse + (_xmouse + _root._xmouse)){
_xscale = this._x - _root._xmouse;
}else if (_xmouse > _xmouse + (_xmouse + _root._xmouse)){
_xscale = this._x - _root._xmouse;
}else if (_ymouse < _ymouse + (_ymouse + _root._ymouse)){
_xscale = this._x - _root._ymouse;
}else if (_ymouse > _ymouse + (_ymouse + _root._ymouse)){
_xscale = this._x - _root._ymouse;
}
}
}


What I am haveing a problem with is geting my _ymouse to size my MC? The _xmouse sizes right.

Thanks
MadWislon

Mc+if Statment?
hallo,

I am trying to create a website; and for the home page; i have thus MC with a button inside.
and the AS on the MC i have:


ActionScript Code:
onClipEvent(mouseMove){
_alpha = _alpha+1;
}

but i also wont it to fade out once mouse is moved again ???

cheers

ps; i dont know much AS so much help appreciated

It's That If Statment Again
I have this code on a square holding a menu:

ActionScript Code:
onClipEvent (load) {
    var e = .2;
    var startx = _xscale;
    var endx = startx;
    var starty = _yscale;
    var endy = starty;
    endx = 710;
    endy = 310;
    if (this._xscale == 710 && this._yscale==310) {
        _root.gotoAndPlay(42);
    }
}
onClipEvent (enterFrame) {
    _xscale += (endx-_xscale)*e;
    _yscale += (endy-_yscale)*e;
}

I'm trying to move the playhead to frame 42 of the main timeline once the square scale to it's desired size of 710 by 310.
but the if statement is not working.
what's wrong with the script?
thank's in advance

If Statment Help
Ok heres what im doing, i have a movie clip and a button

button1
movie1

on my rollover i gave it actions to play movie1, but if i roll over another button i want to write an if statment to check the frame position and not play (second mouseover) untill the movie is done playing...I never had to write an if statment for a situation like this, and well im not even sure if its the right way to do it...any help is appreciated
Thanks guys.

P.s I can show a demo, but its private. so PM me if your serious...thanks.

:: If Statment Evaluation Help ::
If (this is the second time youve play this in a row)
gotoAndplay (frame 7);
else( go to play frame 1)
}

Basically I want to have a script that if you click a button then click it again it will take you somewhere else. BUT if you click it once, then click something else, then click the first button again it will take you to the original spot.

thanks
n

sorry if that didnt make any sense

Loop Statment
I want to loop a small movie 3 times then stop.

I've tried several types of "for" and do while statements but they dont seem to work...

here's an example

for (i=0; i<3; i++) {
gotoAndPlay (1);
}

ta

IF Statment In Actionscript
Although I'm new to action script but I've worked with VB , VB script and ASP for two years. anyhow, this the problem:
I have created a 2 scenes: - scene 1 and scene 2
Scene 1 has 20 frames, start and stop at frame 10 with two buttons, if you click on button 1 the action is to go to frame11 and pass the variable indicates that button one selected so at the end of the scene it will jump to scene 2.
If button 2 clicked then it'll still go and play frame 11 but it'll pass the variable with a different value so at the end of scene 1 it should jump back to the first frame of scene1.

What I wrote at frame20 Scene1:

if (myvar="butt1") {
gotoAndPlay("Scene2", 1);
}
if (myvar ="butt2") {
gotoAndPlay("Scene1", 1);
}

I also tried using else if:

if (myvar="butt1") {
gotoAndPlay("Scene2", 1);
}
else if (myvar ="butt2") {
gotoAndPlay("Scene1", 1);
}

In both cases it was going into the first IF and play it which Scene 2 Fram2

Any help will be appreciated.

Mark

Conditional Statment
i have a problem with my flash project.
what it's suppose to do is check if the slopeA,riseA,runA variable is correct. The co ordinates are randomly generated.
the user will need to put the value in those test boxes and if it's correct then it will pop into next frame and count plus one , if not then it will pop into other frame
but it doesnt work properly
can someone please help me?
the file is attached above

scene 8 does all these actions
PLEASE help me
if you can help plesae contact me through ICQ # 16552975 or MSN Cederick_Wong@hotmail.com

please !!
need this ASAP
thanks !

If Statment Problem....
Hi,

I'm trying to make a Dynamic txt box that changes depending on how well you scored in a quiz.

The values for:

vPassScore
vJustPassedtxt
vPassedtxt
vFailedtxt

are all imported from a txt file with the Q and A's on.
But the below statment doesn't return any txt in the dynamic txt box
vScoretxt.

code: if (score == vPassScore) {
vSocretxt = vJustPassedtxt;
} else if (score >> vPassScore) {
vSocretxt = vPassedtxt;
} else if (score << vPassScore) {
vScoretxt = vFailedtxt;
}


if i make dynamice txt boxes for each value they popular OK. I know that there is a simple error somewhere but i just can see it.

Paulo

If Statment Gone Wrong, What Do I Do?
ok, i have 3 buttens and they each control a MC, i have the scripting setup so that it will detect if the other MC's are open or not and if they are it closes them, the script is somthing like this;

on(release){
_parent._parent.profile.gotoAndPlay(2)

if (_parent._parent.portfolio._currentFrame!=1) {
_parent._parent.portfolio.gotoAndPlay(13)
}
if (_parent._parent.contacts._currentFrame!=1) {
_parent._parent.contacts.gotoAndPlay(16)
}
}


but the thing is, if you play with the buttens a little, trying different combinations of them, after a few those commands seem to get all screwed up, and windows are coming in and out of the stage when they shouldnt be moving. id you go to my website u can see what im talking about, drop the menu down and flick around with the menu, if you have a cure for the problem please let me know.
Cheers

http://www3.sympatico.ca/ben.banks/

Help With Switch() Statment (FMX)
Hi,

Ive been looking at this for hours and I cant seem to find the bug in my coding . Could someone please take a look? Essentially this switch statement decides on whats passed to the preloader function "showLoading". My "nothing test case" works (obviously), and i get the following output from the "nothing test case" trace:

code:

nothing test case
this.xmlFile: 28, this.contentUrl: 4, this.targetClip: 5



code:

switch(this.xmlFile, this.contentUrl, this.targetClip){
case (this.xmlFile.length>3 && this.contentUrl.length>0 && this.targetClip.length>0):
trace("case 1");
//begin load movie
eval(this.targetClip).loadMovie(this.contenttUrl);
//create XML obj and load xml file
this.xmlData=new XML();
this.xmlData.ignoreWhite=true;
this.xmlData.load(this.xmlFile);
//start preloader
this.loadComplete = setInterval(this, "showLoading", 50, this.targetClip, this.xmlFile);
break;
case (this.xmlFile.length<=3 && this.contentUrl.length>0 && this.targetClip.length>0):
trace("case 2");
eval(this.targetClip).loadMovie(this.contenttUrl);
this.loadComplete = setInterval(this, "showLoading", 50, this.targetClip);
break;
case (this.xmlFile.length>3 && this.contentUrl.length<1 && this.targetClip.length<1):
trace("case 3");
this.xmlData=new XML();
this.xmlData.ignoreWhite=true;
this.xmlData.load(this.xmlFile);
this.loadComplete = setInterval(this, "showLoading", 50, this.xmlData);
break;
case(this.xmlFile, this.contentUrl, this.targetClip):
trace("nothing test case");
trace("this.xmlFile: "+this.xmlFile.length +", "+"this.contentUrl: "+this.contentUrl.length+", "+"this.targetClip: "+this.targetClip.length);
break;
default:
trace("Error: cannot continue, no content to load")
break;
}

Condition Statment Ignored?
Hello,


I'm attempting to cycle through an array one value at a time a display each resule in a field "field1"
This part of the code functions ok.

My problem arise when I test for a condition in field1 or field2.
The condition statments are totally ignored?


//INT
//cycle through array
var step=0;
var varray = new Array("start",1,2,3,4,5);
var field2 = 4;

function fstep(){
step+=1;
trace(step);
//loop array[step]
for(i=0; i<=varray.length; i++){

if(step>=varray[i]){
trace("varray=" +varray[step]);
field1=varray[step];
break;


//Condition statement ignored???

//if exceed array last value do the following...
if(field2>=4){
trace("page number exceeded!");
field2="test";//or last value in array
}
}
}
}


Or better yet, does someone have better method to cycle throuhg an array?

iaustin

[Help]Syntax Of A Statment
code: onClipEvent (enterFrame) {
if (Key.isDown (Key.RIGHT)) {
play();
} else {
if (this._currentframe>1) {
gotoAndStop(1);
}}}

I have this code to tell the movie to play as long as a key is down. I want to include other keys too, but am having trouble getting the right syntax.

I tried this:
code: onClipEvent (enterFrame) {
if (Key.isDown (Key.RIGHT)) {
play();
if (Key.isDown (Key.LEFT)) {
play();
}
} else {
if (this._currentframe>1) {
gotoAndStop(1);
}}}
but only the the right key would allow the animation to play... Any ideas?

[F8] Complex If Statment
... or so I think. I have 4 comboboxes which are all optional, yet all use the "and" condition. So if a user only selects two option, the results must be within both of those criteria. If they select 3, the results must meet all 3. And so on. So I have started writing it out and I think that I am going to end up with 17 pages of if statements, unless someone knows of a better way, as I'm sure there is one. So here is what I have so far:


Code:
btnSearch.clickHandler = function(){
txt.htmlText = "";
prodFamSelected = cbProdFam.selectedItem.label;
prodIndSelected = cbProdInd.selectedItem.label;
brandSelected = cbBrand.selectedItem.label;
litTypeSelected = cbLitType.selectedItem.label;

function searchAndReplace(holder, searchfor, replacement) {
temparray = holder.split(searchfor);
holder = temparray.join(replacement);
return (holder);
}

myXML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function(success) {
if (success) {
var litname = new Array();
var fam = new Array();
mainItem = this.firstChild.childNodes;
subItem = this.firstChild.childNodes[0].childNodes[2].childNodes[0].childNodes;

for (var j=0; j<mainItem.length; j++) {
brand = mainItem[j].childNodes[2].attributes.name;
litname[j] = mainItem[j].childNodes[1].childNodes[0];
filepath = mainItem[j].attributes.filePath;
url = searchAndReplace(filepath, "/Files", "Files")
type = mainItem[j].attributes.type;
//let's grab the families nest and place in fam array
for (var k=0; k<subItem.length; k++) {
fam[k]=subItem[k].childNodes[0];
}
//start checking selections versus results for display
if (prodFamSelected == "Product Family") {
if (prodIndSelected == "Product Industry") {
if (brandSelected == "Heritage Brand") {
if (litTypeSelected == "Literature Type") {
txt.text = "Error - Please Make At Least One Selection";
}
}
}
}
if (brand == brandSelected && type == litTypeSelected) {
txt.htmlText += "<a href="+url+">"+litname+"</a>";
}
}
}
};
myXML.load("image.xml");
stop();
}
And it works. A user selects brand "Accord" and type "Instruction Manual", they get a list of Accord Instruction Manuals. But that's the more minimalistic if statement and doesn't cover near the ground I need it to. Any help will be greatly appreciated! Thanks.

Flash IF Statment ... %^$&*#
Hi Folks,

very new to flash, learning lots, traditional procedural programmer (i.e. Turing in the 80's)

The following piece of code is not the program, just the part I am having trouble with.

I want the code to enter the "else" section, but it does not

var ticks = 10;
var m = 3;
var b = 1;
var numbpt = 0;
y = ticks;
x = (y-b)/m;
if ((x>-ticks) && (x<ticks)) {
numbpt = numbpt+1;
if (numbpt=2) {
point2x = x;
point2y = y;
trace("numbpt=2 business");
} else {
trace ("Should be here, but not!!!!");
trace(x);
trace(y);
point1x = x;
point2y = y;
}
}


Any help would be appreciated.

jtp

p.s. Program is a game that involves plotting y=mx+b equations on a grid

If Statment Question
Hey everybody I'm making a game and I have three different jobs: Mage, Archer, and Warrior. I wrote an if statement using variables which doesn't work and I'm hoping somebody can correct me. Thanks!

if(job = "archer"){
character.gotoAndStop(11);

}
if(job = "mage"){
character.gotoAndStop(18);

}

(frame 11 in character is the start of the archer animations, while 1 is the mage's)

Thanks everybody!
(its all written on a frame previous to the actual gameplay)

If _alpha Statment
ActionScript Code:
mywork.onEnterFrame = function(){
    if(this._alpha<0){
        this.loadMovie(_root.nextMovie);
        trace('movie loaded')
    }else{
        trace('movie not loaded')
    }
}

Can anyone explain to me why this is not loading the movie or tracing what it says the the if or else statement?

Exiting An If Statment
I found a way to "do something" when an flv ends, but I have to hardcode the length of the video. Now i just need to exit the if statment and the checker function all together. Right now it just infinitely traces "Video is finished!" and adds buttons by way of my AddChoiceGen2 function. Please help!


Quote:




function vid1Play(CLICK:Event):void{
videoStream.play("vid1.flv");
//Monitor the video
this.addEventListener(Event.ENTER_FRAME, checker);
function checker(ENTER_FRAME:Event):void{
if (videoStream.time >= 1.7){
trace("Video is finished!");
AddChoiceGen2(null);
iCheck = i++;
}
}
}

The :? Conditional Statment Example Please.
Hey all.

Can someone please give me an example of the :? conditional statment.

i just forgot how to use it and need a reminer.

Using FileFilter With And If Statment
Hi, I my problem has to do with my AIR app that I am building.

This what my program does so far:
browseForDirectory, user chooses the folder they would like to look at. Then the application displays the list of files.

What I need my app to do:
I want the application to just display html files when the user pick the directory. I need to do this using fileFilter and an if statement.

It probably seems pretty easy but I am still trying to learn AS3 and AIR, and I have alway had a problem setting up if statements, lol.

If anyone could help me out that would be great.

Half An If Statment?
this ones odd..
i have a load of functions inside of a button on press action, but i only want to make them work the first time the buttons been pressed.. so i add a variable and an if statement to the onRelease function.. easy enough, cept for some reason it only get up to the first tween then does nothing. diddly squat. just kinda sits there and nothing else works cept for some of the button animations.. heres the code fer one of the buttons:

home.onPress = function() {
if (_global.finished == true) { <----this is the statement thats giving the greif
new Tween(cont_mc.cont, "_alpha", Regular.easeOut, 100, 0, 12, false);
away = setInterval(awayer, 700); <-------coz it doesn't get past here
closed = setInterval(closer, 10);
function awayer() {
if (cont_mc.cont._alpha<=0) {
new Tween(cont_mc, "_yscale", Regular.easeOut, 100, 0, 12, false);
clearInterval(away);
}
}
function closer() {
if (cont_mc._yscale<=0) {
clearInterval(closed);
gotoAndStop(1);
}
}
services.enabled = true;
prices.enabled = true;
example.enabled = true;
test.enabled = true;
home.enabled = false;
_global.finished = false;
}
};

there are a few other bugs i am aware of but right now i'm only really intrested in this if thing, however any thoughts would be appriciated highly.
cheers!!
ads

Array In If Statment
HI,

I want to check to see if a string is in an array, so basically:

If (string1 == [any item in array]) {
// do something.
}

but i am not sure how to write it.. any ideas?

thanks.
Gareth

Conditon Statment
Last edited by clydec3 : 2003-08-07 at 11:48.
























Hi
I have an mc "nav"
another mc "main"
and a button.
I want "main" to play only after "nav" finish playing.
I can't put an action commend in the last frame of "nav"
(_root.main.(Play); )as it will be called by different buttons.
What statment should i use?

I tried all the statment if, for, while, do while...etc.. with no results.

thank's in advance
regards

IS This Posible With If Statment
Ok I have MC wich has 12 frames and stop() on frame 1 and 12. Is there way to see if MC timeline has reached 12th frame so I can trigger next action. I have searched through flash help and I'v found _currentframe but that dosent work. I could make bigger delay on alphaTo but I'm interested to see if this is possible in this way.

Here is my code so far

Code:

pismo.onTweenComplete = function(){
   this.gotoAndPlay(2);
   if(this._currentframe == 12){
   _root.papir._visible = true;
   _root.papir.alphaTo(100,1,"easeInExpo",1.3);
   _root.papir.onTweenComplete = function(){
      _root.pismo._visible = false;
      //this.tekst.alphaTo(100,.5,"easeInExpo");
   }
   }

Thanks

Goto Frame After If-statment
I have a problem with going to for example a next frame in a scen after a condition that I've put in a MC.

..lets say that the last frame in the clip contains something like:

if (_root.myvar==5{
gotoAndPlay (2);
}

what happens is that the MC restarts if the condition is met, and this is not what I want to happen.
Anybody have a clue? or any idea how to put the condition i the main fram so that it doesn't have to be in each MC?

Clear All Variables Upon One Statment.
is ther a quick way to clear all variables
in a movie in one statment without
reloading the movie?

i have let say 20 dynamic vars.

upon movie end i want to restart
everything but without reloading the movie
just clear all variables and go to frame 1 to restart.


piny.

The If Statment Dont Work....
hello everyone...
let me bother u a little with my stupid problem

i made a button that ask the movie to go to next frame and play until it stops in the 15th frame and if the current frame is 15, then it goes to the next frame but that didnt work, i attached the file and i hope that u resolve it..

anouther question:
how to make a menu like the menu in this site: http://www.teknision.com
when i hit on company it opens a new menu and it doesn`t cover the other buttons and they go down, whats the idea of this menu? i tried to make one like it but it didnt work, it covers the other buttons. i hope u will answer me......
thanx in advance

[nearly Resolved] If Statment Problem
i figured out how to have more than one condition in an if statement, but my code still doesn't work, can someone help please?
code: onClipEvent (load) {
if (letterboxz._visible == true && letterboxl._visible == true && letterboxa._visible == true && letterboxt._visible == true && letterboxa2._visible == true && letterboxn._visible == true) {
this._visible = true;
} else {
this._visible = false;
}
}

If Statment Not Working On Button
I have the following code on a button:

on(release){
if (menu1._visible = false){
menu1._visible = true;
}else{
menu1._visible = false;
}}

If I mess around with it it either hides or shows the image, does it need a function? if so can you show me an example.

I am fine with asp but can't get to grips with this flash stuff, only my 2nd day though!!

If Else Statment Wont Work. Please Help
I am making a simple shopping cart that holds three items. I have a variable named itemnuber that is supose to determine where to put the last item added. Below is my code. It will add the firt item name, price, and change the itemnuber to 2 but then it wont add to the second. This code is on the add to cart button. Can anyone help?

Code:
on (release) {
if (_level0.cart.itemnumber=1) {
_level0.cart.item01 = "Busines Card Design";
_level0.cart.price01 = 75.00;
_level0.cart.itemnumber=2;
} else if (_level0.cart.itemnumber=2) {
_level0.cart.item02 = "Busines Card Design";";
_level0.cart.price02 = 75.00;
_level0.cart.itemnumber++;
} else if (_level0.cart.itemnumber=3) {
_level0.cart.item03 = "Busines Card Design";";
_level0.cart.price03 = 75.00;
_level0.cart.itemnumber++;
}
}

Simple While Statment Problem
g'day all im learning actionscript with the training from the source book and i am starting to try my own projects, i tried writting a simple "while" statment that links to a function (RedTween) that tweens the xscale of a red box (red1_mc) but for some simple reason i can't get it to work.

as you will note if i execute RedTween(red1_mc) out side the while statment the tween will occur but not if i execute it inside the while "statment"

i have attached the fla as well if anyone wants to see. my project idear was to make the text appear line after line by using mask tweens for every line of the text then xscale tweening them one after the other to zero.

If any one has got the time to have a look it would be Appreciated

var i:Number = 1

while (i<2) {

RedClip = ("red"+i+"_mc");

trace(this.RedClip);
RedTween(this.RedClip)

i++

};

//RedTween(red1_mc)

function RedTween(RedClip):Void {
MyFunction = new Tween(RedClip, "_xscale",None.easeNone,0, 100, 3, true)
MyFunction.onMotionFinished = SetLoop

};

function SetLoop () {
LoopDone = true
};

Import Statment Help Requested
I'm using

PHP Code:



import flash.geom.Transform
import flash.geom.colorTransform




which causes some movie clips to change colors my code works fine in a test .swf but when i try to integrate the code into a larger project then i get an error which says flash.geom.Transform could not be loaded and flash.geom.colorTransform could not be loaded.....i have no idea what is causing those errors. Plz help me to understand how to import the class packages that i need.

Statment Must Appear Within On Handler Error[F8]
Hey all, I'm getting the error "statement must appear within on handler error" with the following code:


Code:
var newgrounds:String = "http://www.newgrounds.com/audio/";
on (release)
{
getURL(newgrounds, "_blank");
anybody know the problem? Thanks for help!

RemoveChild In An If Statment After Loading A SWF
Hello

I know there are a lot of posts on removeChild and I have really looked for a way to solve this but with no luck.

I want to load an external SWF file and put it in a Movie Clip if the user hits a button. Here is the code.


Code:
function mmLink(event:MouseEvent):void
{
if(!opgL){
//Sizes the back menu
Tweener.addTween(menuBack,{height:620, y:35, time:1});

//Makes the SWF request and loader
var opgP:URLRequest = new URLRequest('opgPrint2.swf');
var opgL:Loader = new Loader();

//Loads the URL request and put the Child on the Stage
opgL.load(opgP);
addChild(opgL);

//Sets the MC alpha
opgL.alpha=0;

//Before Tweening it
Tweener.addTween(opgL,{alpha:1, time:3});

}else{
// is suppose remove the Movie Clip
//opgL.parent.removeChild(opgL);
//parent.removeChild(opgL);
removeChild(opgL);

//puts the back Menu to where it should be
Tweener.addTween(menuBack,{height:116.2, y:493, time:2});

}

}
I have tried to do this a number of different ways, with an
else if(opgL), if (opgL != null). I have tried setting a Boolean but I get the pesky.


Code:
#2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/removeChild()
at ScriptSiteMCswitchTest_fla::MainTimeline/mmLink()
I know the swf is loaded and there but It' Won't Go Away! I just keeps loading the same swf over and over again.

I would be great to get some insight.
I am really at a loss

On Button Click If Statment
Hi All

I have a flash movie that plays through automatically pausing on each frame for a set amount of seconds.

I used the following code to pause the movie which works 100%:
stop();
var interval:Number = setInterval(
function():Void {
play();
clearInterval(interval);
},
2000
)

But now i have several buttons on the movie as well, now what i want to happen is that when any one of the buttons is clicked it should ignore the above piece of code and not pause on the frame but stop on the frame.

I need help in doing this please, not quite sure as to how to achieve it.
Any help will be appreciated.
Thanks.
Tak

If Statment In A Enter Frame
I have an If statment in a on(EnterFrame) in side the actions of a movie clip. For some reason it does not work. I have other if statments in on enter frames and they all work but this one jsut doesn't.

I was told that a on(enterframe) continues to repeat the code while the frame head is over it so it should alwasy check the if statment until the conidtion comes true and moves the frame head. Is my logic not correct?

Here is the code

PHP Code:



onClipEvent (enterFrame) {
    if(_root.life <= _root.dead) {
        gotoAndPlay("main", "gameover");
    }





It is for a shooting game. "life" starts at "100" and "dead" is "0". When my "life" drops to "0" it will be less then or equal to "dead". It should goto the fram label "gameover" which has a stop action and display some game stats. Any ideas

?for Loop In A If Condtional Statment?
is it possible to make a shortcut something like this.
this one doesnt work, but I thought there could be a way to
make it work

if (for(i=0;i<25;i++){this._parent["thb"+i]._xscale===100}) {

uncover();

}

On Button Click If Statment
Hi All

I have a flash movie that plays through automatically pausing on each frame for a set amount of seconds.

I used the following code to pause the movie which works 100%:
stop();
var interval:Number = setInterval(
function():Void {
play();
clearInterval(interval);
},
2000
)

But now i have several buttons on the movie as well, now what i want to happen is that when any one of the buttons is clicked it should ignore the above piece of code and not pause on the frame but stop on the frame.

I need help in doing this please, not quite sure as to how to achieve it.
Any help will be appreciated.
Thanks.
Tak

On Button Click If Statment
Hi All

I have a flash movie that plays through automatically pausing on each frame for a set amount of seconds.

I used the following code to pause the movie which works 100%:
stop();
var interval:Number = setInterval(
function():Void {
play();
clearInterval(interval);
},
2000
)

But now i have several buttons on the movie as well, now what i want to happen is that when any one of the buttons is clicked it should ignore the above piece of code and not pause on the frame but stop on the frame.

I need help in doing this please, not quite sure as to how to achieve it.
Any help will be appreciated.
Thanks.
Tak

Conditional Statment Or Listener
Last edited by Codemonkey : 2006-07-27 at 02:00.
























Hello everyone,

I am running into few issues with my site and would really appreciate any input. First question is I have a navigation bar with a series of buttons on it. When you rollover any other these buttons there is and action on them saying :


ActionScript Code:
on (rollOver) {
    this.gotoAndPlay("over");
}
on (rollOut) {
    this.gotoAndPlay("out");
}
on (press) {
_root.main_menu_mc.features_button_mc.enabled=false;
this.gotoAndStop("out")
}

Now I want to create some AS that when a button is click and disabled and then the user clicks on another button all buttons will reset themselves and play "out" if they were previously clicked (enabled=false)

So in the end I am just looking to say "Hey flash if a button 1 is clicked and disbaled and then button 2 is click then button 1 needs to enabled itself and play "out".

I am open to any clean proper ways of coding this. I am trying to become more clean and intuitive with my AS so any suggestion would be great. THANKS!

If Statment In Function Not Working
Hi all,
I have a very simple problem that’s driving me up the wall.
I have an array of buttons.
This array calls upon a function
This function plays a sound for every button,
Within this function there is an if statement which checks which button is pressed.
If the relevant button is pressed then some buttons and a menu slider will disappear and some other buttons will appear or visa versa.

So far I can get the if statement to make the menu slider disappear but not the buttons. However if i press the buttons really fast then I can see them disappear and the other ones reappear - and then disappear really quickly.

Confused yet - take a look at my code:

Code:

onEnterFrame = function() {
downButton2_btn._visible = false;
upButton2_btn._visible = false;

uparrow_btn._visible = true;
downarrow_btn._visible = true;
}
//---------------Set all Functions ---------------------
//---------------Function: menuSlider ------------------
function menuSlider() {
//Play sound clip
buttonSound_sound = new Sound();
buttonSound_sound.attachSound("click");
buttonSound_sound.start(0,1);
buttonSound_sound.setVolume(100);

if (buttons = uparrow_btn){
// Make the menuSlider dissapear
mainMenu_mc._visible = false;
upButton2_btn._visible = true;
downButton2_btn._visible = true;
uparrow_btn._visible = false;
downarrow_btn._visible = false;

}else{
// Make the menuSlider apear
mainMenu_mc._visible = true;
uparrow_btn._visible = true;
downarrow_btn._visible = true;
downButton2_btn._visible = false;
upButton2_btn._visible = false;
}
}
//--------------- Set all Buttons -----------------------
//--------------- Button: menuSlider -------------------
var buttons = [uparrow_btn,downarrow_btn,upButton2_btn,downButton2_btn];
for(i = 0; i < buttons.length; i++){
buttons[i].onRelease = function(){
menuSlider()
}
}

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