Variable Checking Isn't Working?

Jul 14, 2009

Google is ranking my site preety high BUT (bigBut) in MOST searches it lists my swf-s not html pages. So when clicked they are shown in a browser window as single swf-s, not as part of html page. I am trying to workaround this by means of some variable to inspect if swf is opened as standalone or within a html.Here is the problem. I've set up a swf (swf_01 for example) in html page that loads another swf (swf_02) which is in swf_s directory. Swf_01 establishes a variable _global.isActive = 1; when html loads swf_01. So if swf_02 is loaded into the swf_01 variable is TRUE and that is OK and if the swf_02 is loaded directly from search results as a standalone swf it's not OK. That works so far. In swf_02 there is a code that checkes if variable is undefined (meaning that swf is loaded directly from search results) and, if it is, loads the right html into "_self".Somehow it's not working. Maybe my code isn't right.

Code in swf_02 (loaded one):
/if(isActive==undefined){ loadMovie("http://www.mydomain.com/index_services.htm", "_self");} // meaning: if variable is not true > this swf is loaded into browser directly from search

[code]....

View 7 Replies


Similar Posts:


CS3 - Key Checking Function Not Working?

Sep 8, 2009

I must admit I have struggled with this thing for a bit. It seems simple but for whatever reason I can't get it to work. I just want to make something move in AS 3 right now, and so far I've tried puzzling together two different tutorials, but both of them are missing either some source files or further explanation.

Anyway, here is the code (The bit I am having problems with)

Code:
//event listener checks for key presses
stage.addEventListener(KeyboardEvent.KEY_DOWN, checkkey);
//Create keyHandler function

[Code].....

The problem is the checkkey function in the update function. If I leave the parenthesis empty it tells me it needs an argument, if I leave it like that it tells me I need a right paren before colon.

View 2 Replies

ActionScript 2.0 :: Checking To See If A Variable Contains Anything

Aug 25, 2009

I need to know if it's possible to check to see if a variable contains any information or if it's just blank basically I have a text file on the server that may or may not have a url in it, I have my flash file programmed to grab the url from that text file and apply it to a button that when clicked brings up that URL...but that text file may not always have a URL in it, so for those times i want the button to not be clickable, or at least not attempt to go to a URL.

[Code]....

View 1 Replies

ActionScript 2.0 :: Checking Equality Of Two Numbers Not Working

Aug 31, 2009

Got two numbers and need to check if they match up (same value).
this won't fire/doesn't work:
if(codeNumb == exCode){};
But this does work:
if ( (codeNumb + exCode)/2==codeNumb){}
What gives?

View 5 Replies

ActionScript 3.0 :: Checking If Variable Is Provided?

Jun 28, 2009

Is there a good way to check if a variable has been passed into my flash movie?For example lets say I have an app that looks up some data based on location. And I allow for it to be added to the HTML tags, In Flash how to I say set a default location in case of there not being one in the HTML tags?

View 4 Replies

Javascript :: Checking == Or Just Mutating The Variable?

Jun 14, 2010

Imagine I had a variable called X.Let's say every 5 seconds I wanted to make X = true. (it could be either true or false in between these 5 seconds, but gets reset to true when the 5 seconds are up).

Would it be more efficient to check if the value is already true, then if not, reassign it to true? Or just have X = true?in other words, which would run faster?

if(x==false){
x = true;
}
vs
x = true;

On one hand, the first program won't mutate the variable if it doesn't have to. On the other hand, the second program doesn't need to check what X is equal to; it dives straight in.

View 4 Replies

ActionScript 2.0 :: Checking Through MovieClips - Array Code Not Working

Aug 22, 2010

I'm trying to check through an array to see if any of my movie clips are currently on frame 15, before taking giant leaps I was trying to just get it to work with one var in the array before all of them, for some reason this code is not working, the trace is not coming up.

Code:
stop();
var anybtn:Array = [btn1_mc, btn2_mc];
trace(anybtn[1]);
btn1.onPress = function(){
if(anybtn[1]._currentframe == 15){
trace ("Array Check Working"); .....

If someone would like to go a step further and show me how to check through all movie clips. There will be many more than btn1_mc and btn2_mc so I will definitely need to use an array.

View 4 Replies

Actionscript 3 :: Checking If A Variable Is Of The Object Type?

Dec 11, 2009

I want to do something like this in Actionscript 3:

if(variable is Object) ...;
else ...;

Where variable could be a String(), Number(), Array(), Object()...Currently the above check returns true for all of these types, which makes sense. I only want it to return true for objects made with new Object(), however.

View 2 Replies

ActionScript 3.0 :: Flash Checking If Variable Exists In Object

Nov 28, 2011

I'm attempting to make a platform game. Each level is contained within it's own MovieClip, which has it's own class. Each of these classes extend the Level class, which provides basic functionality for all levels.

Each individual level has a numPlatforms variable which stores the number of platforms in that particular level. I currently have a for loop that runs from 1-numPlatforms and sets the level area (the image, more or less) the platform contains:

[Code]....

Is there any way to check if a variable exists within a MoveClip? I've trying comparing it to null and also to undefined, but neither works.

View 2 Replies

ActionScript 3.0 :: Mouse Event Listener Not Working - Checking To See If A Form Exists In The Same Spot

Dec 6, 2009

I have a form that is being created at the point the user clicks on. The algorithm is checking to see if a form exists in the same spot- if it doesnt, new object is created, if it does- result is traced. If no objects are on the stage- a new object is added. For some reason in this code- I get no results for the Mouse_Down event on the form itself. Method being called in main timeline:

[Code]...

View 4 Replies

ActionScript 3.0 :: Using This[] To Reference A Variable - Not Working ?

May 2, 2010

I'm writing a function which can take the names of different variables and use them to do some calculations. Long story short, I want to be able to call the function like this:

It probably seems like a really roundabout way to pass the variable through its name rather than just passing the variable itself. This is related to me using XML to get the variable names, so they come in as strings. Just bear with me here.

Inside the function, I want to be able to do something like this:

which should then trace the variable's value. Unfortunately, I just get an 'undefined'. How do I use 'this[]' to get the value of the variable from a string corresponding to the variable's name?

View 6 Replies

ActionScript 2.0 :: [CS3] GotoAndStop (variable); Not Working?

Feb 13, 2009

I have a simple 3 frame file.

Frame 1 (main code, aka: the problem area)
Frame 2 (gotoAndPlay (1)
Frame 3 (Content Frame, aka: destination)

The concepts I'm trying to understand are two-fold: Creating Variable, and Loading them externally.

Here's my code:

Code:
var varFrame: Number;
var my_lv:LoadVars = new LoadVars();
my_lv.load ("external_code.txt");

[code]....

I can get the project to return the number "3" to the output window, but I can't get gotoAndStop (varFrame); to work.I understand this is a pointless program, but the project I'm building for work uses all these same lines of code (almost).

View 5 Replies

ActionScript 3.0 :: Using This[] To Reference A Variable Not Working?

May 2, 2010

I'm writing a function which can take the names of different variables and use them to do some calculations. Long story short, I want to be able to call the function like this:

function caseConditionEvaluator( nameOfVariable:String )

It probably seems like a really roundabout way to pass the variable through its name rather than just passing the variable itself. This is related to me using XML to get the variable names, so they come in as strings. Just bear with me here.

Inside the function, I want to be able to do something like this:

trace( this[nameOfVariable] )

which should then trace the variable's value. Unfortunately, I just get an 'undefined'. How do I use 'this[]' to get the value of the variable from a string corresponding to the variable's name?

View 3 Replies

ActionScript 3.0 :: [FDT] Refactor Variable Not Working?

May 26, 2010

Just taking my first stumbeling steps from Flex Builder towards FDT.As I understand refactoring should work much like in Flex Builder, but when I select a variable for refactoring the dialog box shows the name of the class and if I click OK the class (the current .as file) is renamed and not the variable.No matter what I try I can only refactor the class name.

View 1 Replies

ActionScript 1/2 :: Variable On Input Text Not Working With If / Then?

Mar 25, 2009

I'm using ActionScript 2.0 with Flash CS4 Professional, andI'm running into conflicting info on how to do this depending onwhich Flash book I'm looking at (and is that really a surprise?).1) I want the user to type text into a text field and thenFlash places what they've typed into a variable.So I created a text field of the type 'Input Text' andassigned this variable 'myInput'2) When the user presses a button, I want Flash to look atwhat is in the variable. THEN... If they have typed the correctword, they are sent to frame 19. If they type anything else, theyare sent to frame 38.In this example, the correct word is: "move"So, I placed this script on the button:

on (release) {
trace(myInput);
if (myInput = "move") {

[code]........

View 4 Replies

Flex :: ChangeWatcher On A [Bindable] Variable Not Working?

May 26, 2011

I have a Number variable, named isConflict, whose value is passed in from a parent. I would like to put a ChangeWatcher on this item so that a function named changeBGColor will run whenever the value is changed. Within my creationComplete function of init, i have the following:

var isConflictWatch:ChangeWatcher = BindingUtils.bindSetter(changeBGColor, this, "isConflictChain");

View 1 Replies

ActionScript 2.0 :: Variable As A Function Parameter Not Working?

Jan 28, 2010

I have a function with three parameters, that works fine when I type in the parameter values. The function is tweens(MCname, targX, targY) and it runs properly when I use tweens(btn1, 150, 200) for instance. I need the function to move 6 different movie clips, one at a time, and I am using a variable (Counter) and an if statement to tell the function to run again after one of my tween classes finishes. The code all works, and it will run six times with the same clip if I just type in one of the movie clip's instance names as the MCname parameter. BUT, if I try to use a variable (BTNname) to serve as the MCname parameter, it will not work, making it so I cannot apply the function to my 6 different movie clips. I put a trace on the MCname parameter, and it returns the correct value (btn1, btn2, btn3, etc) but it is not moving the corresponding movieclips. I've tried a number of different methods, but nothing will work..[code]

View 4 Replies

ActionScript 2.0 :: Variable Value Not Working In Button Menu?

Dec 14, 2005

Im creating a menu navigation, which loads a sub menu movie clip from the library on specific button press. It does this by looking at the current selection (a number variable) and closing the currently active submenu. Once loaded it then changes the number variable to the value of the current submenu.

This works fine, most of the time... sometimes the number variable and menu loaded is completely wrong.

There are six buttons on the menu bar, included is sample script from the 'About' button, there is more to the script but it is instances of this sample, only button names etc change.

Code:
about_btn.onRelease = function() {
if (navID == 1) {
_root.submenuHome_mc.gotoAndPlay("close");

[Code]....

View 1 Replies

ActionScript 2.0 :: HitSize MC - Width Variable Not Working

Jun 19, 2008

I have an mc that loads thumbnail images which are then displayed sequentially in a scroller. I have an array that contains the individual widths of the images and i can get them correlating to the specific images. However: when I try to change the hit size of the images (controlled by a hitSize mc which is just a red box) it won't change the ._width of the hitSize mc according to the variable.

This is what I can do:
Code:
hitSize._width = 100;
(which works)

This what I have:
Code:
hitwidth = _root.projectsB[this.menuNum]; //this is the individual width of the image being loaded
hitwidth = this.hitSize._width;
if I trace(hitwidth); I get the correct number, but the above code won't change the size of the mc.

View 4 Replies

ActionScript 2.0 :: Loadmovie - Random Variable Not Working

May 16, 2002

The tutorial in The Best of Kirupa isn't working for me! When I try doing this:

rn = Math.round(Math.random()*1000000);
loadVariablesNum ("flashdata.txt?reload="+rn,0);

I get a debug error: Error opening URL "file:///C|/pathtofolder/flashdata.txt?reload=263757" Where the reload variable is the random number and flashdata.txt is the file that contains the variable I need.

View 9 Replies

ActionScript 3.0 :: Send Variable From Flash To Php Script Not Working?

Jan 9, 2010

I am struggling with sending some variables to a php page from my flash movie. On the last frame of my flash movie i have a button which navigates the user onto a new php page where i want to display the variables in. The code i currently have is :

AS3 -

Code:
// set variables as a string containing the dynamic textfield.
var Introduction:String = (introduction_txt.text);
//

[Code]....

The echo in the php page comes up as Intro=, I need to echo the variable of $intro which contains the dynamic text in 'introduction_txt.text' in flash.

View 3 Replies

ActionScript 3.0 :: Click To URL On RSS Text Not Working On Node Variable?

Feb 18, 2010

I have a RSS feed parsed into one text box and am using imported CSS to format the text in one Textfield that was created with as3.Problem is my roll over and click handler functions for making each text variable a link to the XML URL link will not work unless I point the function at the entire text field. I just want the individual text variables made from the RSS Title nodes, to be set to react to my handleFHTClicked, rollOutHandler and ollOverHandler functions. The movie runs Ok parsing the nodes and picking up the CSS, but I get this error in the output window when it reaches the aformentioned functions..

TypeError: Error #1006: value is not a function.
at AS3_CSS_external_file2_fla::MainTimeline/onLoaded()
at flash.events::EventDispatcher/dispatchEventFunction()

[code].....

View 6 Replies

ActionScript 2.0 :: Loading Variable From External File Not Working

Aug 28, 2005

I'm having trouble with this script. I have an external text file, from which all of the text on the page is loaded. I also have a series of thumbnails, but I need to have different numbers on each page, so I figured I'd put the number of thumbnails into the text file too and then run a loop to create the thumbnails and buttons dynamically. The loop works fine, until I try to use the value I have loaded from the text file. I think it is something to do with it being in a separate function, but I have tried making it _global.counter, I have tried putting the whole for() loop inside the myData.onLoad function. Basically, I have tried everything I can think of and still the loop does not run when the counter value is specified externally.

[Code]...

View 3 Replies

ActionScript 2.0 :: Input Text To Array Variable Not Working?

Jan 12, 2008

I am working on a line rider/ free rider style game in flash (which is coming along quite nicely ). For the whole night I've been trying to create a way to save and load data simply off text and have finally come up with a basic solution for it! I have my information all stored into an array neatly to be later used with the function lineTo upon load. My problem here is that when I actually input the data into the textbox to be picked up by the load button it does not draw the lines like its supposed to.My load button has the following code:

onClipEvent (enterFrame) {
onRelease = function() {
var points = new Array(_root.xInput);[code]......

View 2 Replies

ActionScript 2.0 :: [Flash 8 Class] Variable Alias No Longer Working?

Aug 8, 2006

I like to make alias varaibles for long names, so that i don't have to keep repeating huge lines of text, but when i try to create one for a custom class, it fails.

Code:
Clients["Client"+i] = new Client();
var Client:Object = Clients["Client"+i]

Its almost as if flash is trying to make the new variable a new Project(); instead of a reference to the other variable...

View 2 Replies

ActionScript 2.0 :: Create A String Variable...and Then Use The Value Of That Variable To Declare Another Variable?

Jan 3, 2006

f you know PHP...then you know that you can create a string variable...and then use the value of that variable to declare another variable. like this:

PHP Code:

<?php$foo = "haha";$i{$foo} = "success";print $i{haha};?>

and it would display "success"...or like this:

PHP Code:

<?php$foo = "haha";$$foo = "success";print $haha;?>

and it would also display "success".

View 6 Replies

IDE :: Checking If MC Exists?

May 26, 2009

I have a gallery loading jpegs from an xml file into a mc called mainPicArea, on frame 5. I have other content on frames 1,2,3,4,6,7.

I want to run an if statement to check whether mainPicAreaexists and if it does, then run a removeChild(mainPicArea), and if not do nothing.

[AS]
if (MovieClip.mainPicArea){
trace("exists");
//removeChild(mainPicArea);

[code]....

When I test, it comes back with the trace "doesent exist", even though it does exist.

View 5 Replies

Checking Collision Between Two Symbols

Jan 7, 2010

What kind of code would one need to check for collisions between two symbols? I am hoping to become a game designer so this is important for future references.

View 8 Replies

ActionScript 3.0 :: Checking If MC Exists?

Feb 15, 2010

I have a gallery loading jpegs from an xml file into a mc called mainPicArea, on frame 5. I have other content on frames 1,2,3,4,6,7.I want to run an if statement to check whether mainPicAreaexists and if it does, then run a removeChild(mainPicArea), and if not do nothing.

code:
if (MovieClip.mainPicArea){
trace("exists");
//removeChild(mainPicArea);

[code]....

this is my code. When I test, it comes back with the trace "doesent exist", even though it does exist.

View 5 Replies

Checking Variables With If (varibale = *)

Oct 20, 2010

why this code works on my other flash file and it doesnt on the new one. This is the code:

if (test == "PRIZE1"){
trace ("prizes/prize1.jpg");
}

[Code].....

Basically it should check whther the variable has any of the above words loaded on it dynamically so that it loads a movie that corresponds to it. I put the trace on the above so I can track whther it was reading or not. Obviously it wasnt. My publish settings are Flash Player 8 with Actionscript 2.0

View 4 Replies







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