Actionscript 3.0 :: Get An "if Statement" To Run A Simple Function?

Jul 8, 2009

I am trying to get an "if statement" to run a simple function.

View 5 Replies


Similar Posts:


ActionScript 3.0 :: Simple If Statement Not Working?

Feb 21, 2012

I am attempting to create one function to respond to multiple button clicks. I have a simple if statement in my onBtnClick function that does not work. Just need the button that is in that variable to go to frame 1. Trace statements are working inside the statement so I the if statement runs correctly?

[Code]...

View 3 Replies

ActionScript 2.0 :: Simple If Statement Won't Work?

Feb 18, 2006

I am using Flash 8, and for some reason, my if statement won't work. I have a scrollbar which scrolls a movieclip (that contains AS loaded material (eg. attachmovie). I want it so that only when the material is longer than the scrollbar do I see the scroll bar.For some reason, it doesn't work. The traces don't even work!

if (scrollbar._height < menu_mc._height) {
scrollbar._alpha = 100;
trace("works");[code].....

View 2 Replies

ActionScript 3.0 :: Simple Hide / Show Movie With If Statement?

Nov 24, 2010

I need something like this (not correct code!)

if (MovieClip(this.root).myimage.x -= 100{
MovieClip(this.root).mybutton.visible = false;
} else {
MovieClip(this.root).mybutton.visible = true;
}

So I'm saying if myimage x position in less than 100 hide mybutton.

View 6 Replies

ActionScript 3.0 :: Check To See If An Object Exists By Using A Simple If Statement?

Sep 27, 2010

I'm trying to check to see if an object exists by using a simple if statement.
 
if (object.name) {
//Do this
}
 
However, if the object doesn't exist, I get this error, "Error #1010: A term is undefined and has no properties" - which I understand is because the object doesn't exist. Is there a better way to check to see if an object exists?

View 1 Replies

ActionScript 2.0 :: Can't Get A Simple If/then Statement Working With An Input Text

Feb 19, 2005

i cant seem to get a simple if/then statement working with an input text. Here is my AS

[AS]
on (release) {
password = inputName
if (password == "test") {

[Code].....

For some reason when i type in test in the movieclip inputName it still sends me to ign.com. Everything is in the same frame and i just cant get it working.

View 1 Replies

ActionScript 2.0 :: Simple Timer - Delay For 20 Seconds (IF Statement)

Apr 19, 2004

I'm building a continous move in flash, and I'm displaying some text and images and want to hold the timeline for about 20 seconds and then resume play again. I'm trying to write a simple timer in AS to keep from having to create 10000 frame long movie clips. Here's what I have so far:

stop();
this.onEnterFrame {
time = getTimer();
if (time == 20) {
play();
}}

Unfortunately, this isn't working for me, and 'm unsure why. I suspect two things,
A: my "time" var takes only a snapshot value of the timer and not a continuous value, so the timer never reaches the value of 20. Or,
B: I have somesort of syntax wrong and the if never gets a chance to load.

View 4 Replies

ActionScript 2.0 :: Make A Simple SWITCH Statement With Button._name As Variables?

Jun 18, 2007

I want to make a simple SWITCH statement with Button._name as variables for CASE

so i got this code:

Code:
Button.addListener(_root);
_root.onRelease = function() {

[Code]....

View 2 Replies

ActionScript 2.0 :: Run A Function In An If Else Statement?

Jan 14, 2004

How do I run a function in an if else statement?

View 4 Replies

ActionScript 2.0 :: Get A Function To Run The GetURL Statement?

Jan 10, 2011

I was wondering if there was a way to get a function to run the getURL statement? something similar to this:

function go(){
getURL("www.whatever.com","_blank");
}

View 4 Replies

ActionScript 3.0 :: Maximum Limit To Put IF Else Statement In Function?

Jul 2, 2009

I'm wondering if there is a limit as to how may if else you can put in a function. I have a form that never seems to fire the last if else on the first load. It will work once I've run through the form, and all of the times after that, but never on the first try. In other words, when I test the form for the first time, if # 5 never kicks in. But after the form has sent, I can run the form again and if # 5 will work like I want it to. I did add .tabIndex to the form because it wouldn't originally tab the way I wanted it to and I wondered if this might be part of the problem. I also tried moving the if else statements around, but that didn't seem to make any difference. Does it only read 4 if's at a time?

Here's the code:
// add evenlistener for submit buttonsubmit_btn.addEventListener(MouseEvent.CLICK, ValidateAndSend);
function ValidateAndSend(event:MouseEvent):void{
// if #1
if(company_txt.text ==""){
company_name_mc.gotoAndPlay("red");
[Code] .....

View 5 Replies

ActionScript 2.0 :: Function Not Created Inside If Statement

Jul 1, 2010

[code]...

now when you first look at this code.. it looks perfectly fine right? .. well if you use this exact code and place a clip on the stage with an instance name of 'mc' .. publish and rollover 'mc'... the trace statement does not show.. is there something I never read about with respect of creating functions inside if statements??

I would think you could use the function name(){ syntax.. and not be forced to using variableName = function(){ syntax in creating functions inside if statements..

View 8 Replies

ActionScript 3.0 :: Dropdown Menu - Function Within IF Statement?

Sep 22, 2010

I am trying to make a dropdown menu where the user hovers over a bar it gets larger with more links then when they roll off it disappears. I am struggling to get my links to only appear when the menu is extended.. atm they show all the time. I thought it might be possible to have the btn function inside of the mouse event but it doesn't work.

Code:
import com.greensock.*;
import com.greensock.easing.*;
var emptyMc:MovieClip = new MovieClip();
function mouseMove(event:MouseEvent){
if(mc.hitTestPoint(mouseX, mouseY, true))
[Code] .....

I also would like to call an array at some point to go to the dynamic text field for my links.

View 0 Replies

ActionScript 2.0 :: Making IF Statement In OnEnterFrame Function

Jan 20, 2009

In the main timeline I have this onEnterFrame function. I also have this movieclip and in it's own timeline stops at frame one. When this movieclip is rolled over it plays and then stops at frame 9. I'm trying to make an if statement in the onEnterFrame function that says when that one movieclip is on frame 9, delete the onEnterFrame function.

I tried to do this code, but so far all I have is
if (movieclip._currentlabel = "framenine") {
delete this.onEnterFrame;
}

View 4 Replies

ActionScript 3.0 :: Referencing Function With If Statement Not Working?

Jan 10, 2005

I am trying to reference a function in an if statement and it's not doing anything. The reference is here.

Code:
private function newNumber (qTotal:Number, curNum:Number):Number {
var newNum:Number = Math.floor(Math.random()*qTotal);

[code].....

View 1 Replies

ActionScript 3.0 :: Function Not Triggered Properly From Within IF Statement

Feb 3, 2009

I have set up a system that spawns barriers for the player to dodge but it appears the functions won't trigger properly from within "if" statements.

PHP Code:
var speed:Number=2;
var barNumber:int=6;
var barLoop:int=0;
var timer:Number=0;
var limit:Number=100;
[Code] .....

View 8 Replies

ActionScript 3.0 :: Referencing Function With If Statement Not Working

Apr 30, 2010

I am trying to reference a function in an if statement and it's not doing anything. The reference is here.

Code:

private function newNumber (qTotal:Number, curNum:Number):Number {
var newNum:Number = Math.floor(Math.random()*qTotal);
for (var j:Number=0; j<curNum; j++) {

[Code]....

View 5 Replies

ActionScript 3.0 :: If Statement Or Function For Embedding Xml Files?

Oct 22, 2010

so I am trying to embed xml files for a game based on the button I select. I assume I would need an event listener, however I do not know how the function should look.

Code:

[Embed(source="folder/jonesy.sng", mimeType="application/octet-stream")]
[Embed(source="folder/markysng", mimeType="application/octet-stream")]
[Embed(source="folder/John.sng", mimeType="application/octet-stream")]

The instance name for the button is "jonesy", "John" , "Marky". I would like when the user selects the button jonesy, the above code is activated.

If the user selects " John, or Marky" the corresponding embed code for those are loaded.

I have

Code:

jonesy.addEventListener (MouseEvent.CLICK, whichxml);
John.addEventListener (MouseEvent.CLICK, whichxmljohn);
function whichxml (e:MouseEvent):void

[code]....

this isnt' working though. Not sure what is missing, or if it just needs to be an IF Then statment.I guess embeds have to go on the intro frame, or first frame? But, the problem I have is that, I have so many embeds it is freezing the whole game.

View 3 Replies

ActionScript 3.0 :: Unable To Run Next Statement In Constructor Main Function?

Jan 1, 2012

I have a main.as scipt whereby i put the following in the constructor main function.
 
L1: LoginScreen.enterBtn.addEventListener(MouseEvent.MOUSE_DOWN, checkLogin);
L2: map.visible=true;
 
it will execute checkLogin function but stuck at Line 1. how do i make it run Line 2?

View 1 Replies

ActionScript 3.0 :: Timer Function - Trace Statement Not Working

Oct 23, 2009

I am having a problem with the if statement in my timer function, the trace statement within in it is not working, eventually I wanted to use this if statement further but need to make sure it is working first.

Code:
timerFunction();
} function call in function above
function timerFunction() {
trace("hey");//this trace works
var myTimer:Timer=new Timer(1000,15);
[Code] ......

View 8 Replies

ActionScript 2.0 :: Adding || To An If Statement Stops Function Working?

Dec 10, 2005

I have a movieclip with the instance name information_mc. I am trying to get this movieclip to move up and down, depending on its y co-ord or in what direction it is tweening at the moment it is clicked.I have the following AS:

Code:
information_mc._y = 240;
var curMovement:String = "goingup";

[code]......

View 2 Replies

Sql :: Flash - Make Function Wait To Return After GetResult From SQL Statement Is Available?

Feb 17, 2012

I'm just trying to make a simple function that will return all the data from my SQLITE database as an array. But it looks like when my function is returning the array, the SQL statement is actually still executing... so it's empty... Does anyone have a suggestion? Or am I just going about this whole thing wrong.I know I could just have the event listener functions outside this function, and they could then set the data. But i'm trying to make a AS3 Class that holds all my SQL functions, and It would be nice to have everything for this particular function just in one function, so it can return an array to me.

public function getFavsGamesArray():Array
{
getFavsArraySql.addEventListener(SQLEvent.RESULT, res);

[code].....

View 2 Replies

ActionScript 3.0 :: If Statement : Trigger If The Function Is Triggered By A Specific Movieclip?

Jan 10, 2010

I have a bunch of event listeners that refer to different movieclips but trigger the same function.I have an if statement within this function that I need to trigger if the function is triggered by a specific movieclip.

ActionScript Code:
//movieclip stuff....
addChild(backgroundPoint);
backgroundPoint.addEventListener(Event.ENTER_FRAME, animateBall);

[code]....

I know I could just create two separate functions but the code within the function (not shown here) is fairly long and I dont like repeating code.

View 2 Replies

ActionScript 2.0 :: Call The ImageSize Function With The If Statement It Doesn't Work?

Aug 18, 2006

Code:
_global.picWmax = 436;
But when I call the imageSize function with the if statement it doesn't work.
Code:
function image(){

[Code]...

View 3 Replies

ActionScript 3.0 :: Graph A Simple Function?

Nov 17, 2011

I have been searching the net for a tutorial how to graph functions. I found one from Barbara Kaskosz, very detailed, and too much scripting. Too much for me. Is there another way or place to learn, or I am doomed, and have to face the music and study her stuff. All I want, is to be able to graph a simple function.

View 4 Replies

ActionScript 2.0 :: Simple Fade In And Out Function?

Oct 18, 2007

function that I can re-use and pass movie clips to and cause mc's to fade in and out?...such as

Code:
function fadeMeIn(fadewhat,fadespeed) {
if (fadewhat < 100) {

[code]......

View 6 Replies

ActionScript 3.0 :: Simple Pad String Function?

May 29, 2011

I thought I would share a simple pad string function I created briefly... I know that there may be other similar functions already out there but I decided to make it anyway. It's basically a ripped off as3 version of the str_pad() php function.

Examples:
trace(stringUtils.stringPadLeft('7',4,'0','left')) ; // Traces 0007
trace(utils.stringPadLeft('whatever',2,'~','left') ); // Traces whatever
trace(utils.stringPadLeft('hi',20,'-','left')); //Trace ------------------hi

[code]....

View 2 Replies

ActionScript 3.0 :: Simple Error #1006: Value Is Not A Function

Nov 18, 2011

Well I'm so close to understanding why this doesn't work. First here is the code:

Code:
import flash.display.MovieClip;
stage.addEventListener(Event.ENTER_FRAME,updateGame);
var gameZoneContainer:MovieClip = new MovieClip();
stage.addChild(gameZoneContainer);

[Code]......

If I place "fish_mc" in place of "Items[createItemCounter]", the fish animates but the cookie doesn't. If I put "cookie_mc" instead of "Items[createItemCounter]", the cookie animates but the fish doesn't.

View 2 Replies

ActionScript 3.0 :: Simple While Loop Doesnt Function?

Oct 29, 2009

For each product a label is created determing its category unless a label of that category has already been created before. My while loop is supposed to stop the same label being created twice but apparently it doesnt! My function consists of an array of categories (kategorie[]) and an array of labels that were previously created (previousLabels).

[Code]...

View 4 Replies

ActionScript 3.0 :: Function Only Works In Simple App But Not In Complex One

Mar 11, 2010

I made a simple app with 2 movieclip symbols containing photos of a butterfly with this actionscript:

import fl.transitions.Tween;
import fl.transitions.easing.*;
butterfly_mc.addEventListener(MouseEvent.CLICK, bigPic);
butterflyHand_mc.addEventListener(MouseEvent.CLICK, bigPic);
function bigPic(e:MouseEvent):void{ new Tween(e.currentTarget,"scaleX",Strong.easeOut, e.currentTarget.scaleX, (e.currentTarget.scaleX * 1.4), 4, false);
[Code] .....

I don't get any error messages but when I click on case1_mc.c1_mc.case1a_mc or case1_mc.c1_mc.case1b_mc nothing happens.

View 11 Replies







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