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








If Statments


hi there

i have two statments one is the key
second is the Box

if the key isvisible then i hitTest the the Box it will open

else dont open it

but the Key when i hit Test it it

how can i right it plz help


the code i used is this


Code:
onClipEvent(enterFrame){
if(this.hitTest(this._parent.boy) == (_parent.box._visible == false)){
this.gotoAndPlay(2);
}
}




FlashKit > Flash Help > Flash ActionScript
Posted on: 07-26-2007, 01:22 PM


View Complete Forum Thread with Replies

Sponsored Links:

If Statments
what I wish to do is the following
create an if statment that looks like this

if (_root.movieclip is at frame X){
statment;
}

can I evaluate this?
can anyone helpme out?

thanx in advance

View Replies !    View Related
If.. Else.. Statments
ok I was wondering if you can have more then one condition before you have to use the else statment. Example:

if (variable = whatever) (and) (variable2 = whatever){
gotoandplay (frame 1)
} Else...

I want to connect both of those 2 conditions is there a special operator that can do this or is it not possible?
It is kind of hard to explain but I hope this does it.
Thanks for your help.

Josh

View Replies !    View Related
If Statments
Here goes :S I've got animations from clicking the button to the page and then the same one but backwards back to the main menu.. and i'm working on a submenu for that.

Heres the problem.. i really need to keep the file size small so i've only put on each page the animations of the content coming up etc..
but i cant make a menu that when you click the button you want it will play the rest of the fade out animation on that scene then forward to the scene of witch the button you pressed...

Heres how i see it working and how i fort i had it working :S

Button Action Script.

on (press) {
page = "websites";
}
on (release) {
gotoAndPlay(65);
}

Frame 90 Action Script.
if (page = websites) {
gotoAndPlay("portfolio websites", 1);
}


I would of then set up Else If's for each link however this didnt work. so i dont know whats going on.. I Set up a text box with var=page and set page=none on the first frame and when you click the button the page does change to 'websites' and it is on websites the animation passes over frame 90. So i dont know is it my if? or do i need to declare the page varible? i just dont know.

View Replies !    View Related
MC If Statments...
I am having trouble figuring this one out. First off I am using Flash 8 Pro... My goal here is to have this MC fade in and out when I mouseOver it and mouseOut of it. The issue is that when I mouseOver the MC it fades the content in, but when I mouseOut it tries to fade at whichever frame it's currently on. How can I tell it to fade only IF the playerhead is on the fadeout frame and has finished with the fade IN... I know there has to be a way to make this work seamlessly. All help is appreciated!


Code:
LightBulb.addEventListener(MouseEvent.MOUSE_OVER, mouseOver);
LightBulb.addEventListener(MouseEvent.MOUSE_OUT, mouseOut);

function mouseOver(e:MouseEvent):void {
if (LightBulb._currentframe == "1") {
LightBulb.gotoAndPlay(2);
} else if (LightBulb._currentframe == "<1") {
LightBulb.gotoAndPlay(38);
}

function mouseOver(e:MouseEvent):void {
if (LightBulb._currentframe == "39") {
LightBulb.gotoAndPlay(40);
} else if (LightBulb._currentframe == ">40") {
LightBulb.gotoAndPlay(2);
}

View Replies !    View Related
IF Statments
Code:
if (time.hours > 21) {
fish_mc.gotoAndPlay(3);
}
if its 22 hours now, how come it wont goto frame 3 of the fish_mc !?
it stays stuck in frame 1!?

its part of a whole code...


Code:
_root.time = new Date();
_root.time.seconds = _root.time.getSeconds()
_root.time.minutes = _root.time.getMinutes()
_root.time.hours = _root.time.getHours()

if (time.hours > 21) {
fish_mc.gotoAndPlay(3);
}
Maybe you read my other post about the goldfish thing?
well frame 3 is a mc of the fish sleeping, hense it should be in bed... but fram 1 is just an empty bowl.

please help!?

If not through here then through email? c_warters@hotmail.com

Thankyou!!!

View Replies !    View Related
If...Else Statments
Anybody know how I can clean up this block of code
Code:
if(imageInt0 == undefined){
trace("image0 undefined");
} else{
loadImage_mc.imageEmpty0.attachMovie("imageInt0_mc", "imageInt0_mc1", newDepth);
}

if(imageInt1 == undefined){
trace("image1 undefined");
} else{
loadImage_mc.imageEmpty1.attachMovie("imageInt1_mc", "imageInt1_mc1", newDepth);
}
if(imageInt2 == undefined){
trace("image2 undefined");
} else{
loadImage_mc.imageEmpty2.attachMovie("imageInt2_mc", "imageInt2_mc1", newDepth);
}

if(imageInt3 == undefined){
trace("image3 undefined");
} else{
loadImage_mc.imageEmpty3.attachMovie("imageInt3_mc", "imageInt3_mc1", newDepth);
}
if(imageInt4 == undefined){
trace("image4 undefined");
} else{
loadImage_mc.imageEmpty4.attachMovie("imageInt4_mc", "imageInt4_mc1", newDepth);
}

if(imageInt5 == undefined){
trace("image5 undefined");
} else{
loadImage_mc.imageEmpty5.attachMovie("imageInt5_mc", "imageInt5_mc1", newDepth);
}

Thanks in advance.

View Replies !    View Related
Trace Statments Being Ignored
my debugger just stopped working... totally ignores all of my trace statments. works on other fla's, just not on the one i need. did i disable it somehow? has this ever happened to anyone?

tnx, i know its a dumb question, sry

View Replies !    View Related
Multi If Statments
something that has been bothering me for sometime that no book or teacher has told me, is what to do when i need a condition higher than another.

example: if value great 10 then something, but if value is also great than 20 then do something else.

example:
function healthbaranimtion(){
if (value>=10){bar animation speed = 10};
if (value>=20){bar animation speed = 20};
if (value>=30){bar animation speed = 30};
}

so how do i get the bar animation speed to equal 30 if value is ++30?

View Replies !    View Related
Loop Statments
Hi
If I have a variable called i and it has an intial vaule of 0 how easy is it to builder a counter that increases the value of i by 1 everytime the user clicks on a button - do you need a loop statment and if so how do you use it.

I am new to this kind of thing so if anyone can give me some pointers that would be great.

Cheeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeers

View Replies !    View Related
Variables And If Statments For Quiz
I am setting up a math tutorial for my students and I need some help. I want to set up a question and then have the students answer the question and be able to check if they are correct. If they are correct I want the movie to continue and if they are wrong then I want them to go back to the question and try again.

Here is a sample question

What is the ratio of snowmen to carrots

answer 5 to 3

Thanks


Glenn

View Replies !    View Related
Key Press Mutiple If Statments Or Use The If Else
does any know the difference because in this example both wrk the if statement followed by multiple else statements
or using multiple if statements key presses,what is the difference between the two examples .




if(Key.isDown(Key.LEFT) ) {
this._x -= 5;

} else if(Key.isDown(Key.RIGHT)) {
key_press = 2;
this._x += 5;

} else if(Key.isDown(Key.UP))
this._y -= 5;

//////////////////////////////////////////////////////////////////////////////////////
-------------------------------------------------------------------------
seperate

if(Key.isDown(Key.LEFT) ) {
this._x -= 5;

if(Key.isDown(Key.RIGHT)) {
key_press = 2;
this._x += 5;

if(Key.isDown(Key.UP))
this._y -= 5;

View Replies !    View Related
Help With My True/false Statments
[CODE]onClipEvent(load){
speed=3;
gravity=-1;
base = true;
}
onClipEvent(enterFrame){
if (Key.isDown(Key.UP)){
this._y-=speed;
base = false;
}
if (this.hitTest(_root["base"])){
base = true;
}
if (Key.isDown(Key.UP)){
this._y-=speed;
base = false;
}
if(base = true){
this._y-=gravity;
}
}[/CODE]

trying to make a game, where you start on a base "base" then you fly your ship up with the arrow key up, and when you leave go of the key, you get pulled down by my gravity... but the only way gravity works if if i put

[CODE]if(base = true){
this._y-=gravity;
}[/CODE]
but then gravity always works expect when i got up, down.
if i set it to false, it never works

View Replies !    View Related
CREATING A TEXT FILE WITH HTML STATMENTS
Hello,

this is a complex one (for me anyway). on a particular host there is no Database support. So I decided to use text files that flash reads (no problem so far).

Now I would like to do something a little bit further. I would like to have a flash page where you can literally edit text, and it creates a text file or ammends an existing text file. Also, what would be an extra bonus, would be that when creating the text file (to be read in an HTML textbox) you could have an interface to select which portions of the text you want bold and size and font.... I know i know this is a lot to ask, but the first part would be fine. If there is a tutorial on this, or some example somewhere on the web that would be great.

Thanks in advance.

View Replies !    View Related
Way To Many Else If Statments Make Flash Crash - Other Solution?
I've been trying to write a flash program that will allow the user to enter either a number, or title and compare it to a rather large list (else if statements). So if someone searches for a number or name it will go down my else if statements looking for it until it finds it. Only about 2/3 of the data I've enetered seems to work (the data was done with another program I wrote and am Absolutly sure that the data was entered correctly and there isn't a syntax error in my else if's). I've traced through the program with no luck and am thinking that there are just too many else if's for flash to handle. There are over 1200 else if's in my program. Is there an easier / faster way for flash to perform the same thing?
Code snippet:

on (release) {
_root.createEmptyMovieClip( "image_container", 0 );

if (EnteredDATA == "SW 6988" or EnteredDATA == "6988" or EnteredDATA == "Bohemian Black"){
SWATCHNUM = "SW 6988";
SWATCHNAME = "Bohemian Black";
YESNO = "Yes";
loadMovie("Graphics/SW6988.a.jpg", _root.image_container);
setProperty(_root.image_container,_x,32);
setProperty(_root.image_container,_y,221);
}

else if(EnteredDATA == "SW 6766" or EnteredDATA == "6766" or EnteredDATA == "Mariner"){

SWATCHNUM = "SW 6766";
SWATCHNAME = "Mariner";
YESNO = "Yes";
loadMovie("Graphics/SW6766.a.jpg", _root.image_container);
setProperty(_root.image_container,_x,32);
setProperty(_root.image_container,_y,221);
}

View Replies !    View Related
Bulk Import Statments Vs. Specific Import Statements...any Performance Difference?
Lets say I have 20 classes located at nl/amsterdam/simulation/model/. Now I'm writing another class that is going to use some of those 20 classes. Is there any performance difference in the compiled swf if I import them all using a wildcard:

Code:
package nl.amsterdam.simulation.view
{
import nl.amsterdam.simulation.*
...
versus importing each specific one that I need?:


Code:
package nl.amsterdam.simulation.view
{
import nl.amsterdam.simulation.model.Tulip;
import nl.amsterdam.simulation.model.Canal;
import nl.amsterdam.simulation.model.Prostitute;
import nl.amsterdam.simulation.model.StonedTourist;
import nl.amsterdam.simulation.model.BuisnessMan;
import nl.amsterdam.simulation.model.Windmill;
import nl.amsterdam.simulation.model.CoffeeShop;
import nl.amsterdam.simulation.model.SkinnyBuilding;
...
Or is there only a difference in the time it takes to compile, not the time it takes to execute?

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved