ActionScript 2.0 :: CS3 Variable String Is Wiped When Starting A New Function

Apr 2, 2009

I have 5 links that exist as one large font and four small fonts. The large one dictates the current page and the smaller ones are links to other pages, which become the large font if they are clicked to dictate they are now the new page. When a link is small font link is clicked, it activates 3 tween animations for presentations sake, all dont in actionscript 2. The small font ._y is placed at the bottom of the page and swoops back up. The current large font ._y swoops down and, over this, the newly selected page large font swoops up to replace the previous large font.

I have tried specifying what the current page is in a new object variable so that is is remembered for when a new link (small font) is clicked. However, whenever a new function is started it seems to wipe out the current value of the object, so it cannot pass on what the current page is. Here is the code (I posted this earlier in the newbies section but think it's more suited to this forum, please delete the earlier post if necessary, sorry):

[Code]....

View 6 Replies


Similar Posts:


Actionscript 2 :: Function's Local Variable Through A Concatenated Variable String?

Mar 7, 2012

how you would target a function's local variable through a concatenated variable string.For example:

var txt = "Hello World";
function testing(msg) {
var test1 = msg;[code].........

I'd expect the trace to be "Hello World" but rather is given "undefined". So if variables created outside functions are created on the main timeline, where are local function variables created and how would you access them?

View 2 Replies

IDE :: Pass A String To A Function And Use Its Value As The Variable Name?

Dec 21, 2009

Is there any way that you can pass a string to a function and use its value as the variable name you wish to change. For example.

Code:
var text:String = "Goodbye World";
function myfunction ( varToChange)
{
varToChange = "Hello World";
}
myfunction("text")

View 2 Replies

AS :: IDE - Pass A String To A Function And Use Its Value As The Variable Name

Mar 18, 2009

Is there any way that you can pass a string to a function and use its value as the variable name you wish to change. For example.

[Code]...

View 1 Replies

ActionScript 3.0 :: Access The Value Of A Variable Of Which Only Have The Name As String In A Function

Dec 29, 2009

my goal is to keep my output window organized so i can follow all my traces more easily. so i wrote a couple of custom functions to achieve that. one of them would be: to more easily trace the following variable for example

[Code]....

View 6 Replies

ActionScript 3.0 :: Using String To Define Function And Variable (?)

Nov 16, 2011

I'm trying to make children of a tile and put them in their respective locations. To do that, I need to know what kind of tile is to be created, but if I just use my old method:[code]I will have to use a chunk of code like this for every single imaginable tile. Obviously, that is not efficient! So I'm trying to optimize it by having what tile type is to be posted saved in a string, then using the string to refer to what child is to be created, something like below:[code]how to make the above code work. Surely, there is a way to do this?

View 14 Replies

Actionscript 3 :: Function To Test If A String Variable Is A Number Value?

Jun 16, 2010

Is there a way to test a string, such as the one below to see if it's an actual number value? var theStr:String = '05'; I want to differentiate between the string value above and one such as this: var theStr2:String = 'asdfl';

View 3 Replies

Actionscript 3 :: Call Function Or Object Name In String Variable?

Mar 15, 2012

I need to call an object or function name with string variable.[code]it's working but, if I do something like below its not working [code]

View 2 Replies

ActionScript 3.0 :: Function Receive Variable And Search String In Array

Jul 22, 2009

I have an array index problem. I have an Array that holds some strings. I am trying to write a function that receives a string variable (user input)and searches for that string in the array. for that i tried to use "ArrayName.indexOf(input_variable)" but this always returns -1 even if the string which the variable holds is in the Array.

This is the script:
public static function ValidName(inputName:String = ""):Boolean {
trace(validNames.indexOf(inputName));
if (validNames.indexOf(inputName) > -1) {
return true;
} else {
return false;
}}

View 4 Replies

ActionScript 3.0 :: Detect The Change Of A String Variable And Then Fire A Function?

Jan 9, 2010

It seems that this is quite easy to do but ... I can't get it.

I have on the stage 3 Btns that set my:

Templates.data.templateTxt :

my Templates.as package is:

ActionScript Code:
package {
public class Templates {
public static var data:Object={};

[Code].....

View 3 Replies

String :: Loop Starting With A Number?

Oct 26, 2011

I have buttons with id's button1, button2, button3, etc.

I have a for loop that i need to loop starting with a number and i need to enable buttons based on my loop. I need help taking my string button1 and making that the id "button1" so i can use the button property's.

View 1 Replies

ActionScript :: Flex : Remove Part Of The String Starting From Special Char (or Word)?

Mar 19, 2010

so I have a string "bla dla dla vre bla 54312" I want to turn it into "bla dla dla " by saying something like

function(string, "vre");

how to do such thing?

View 3 Replies

ActionScript 3.0 :: Arrays Getting Wiped Using Different Functions?

Feb 9, 2010

I have a program which fills an array with data loaded from an external XML file. I've used the debugger to step through the program, and what I am seeing is this: Inside the function where the array is filled, the data is inside the array and everything is fine. However, when I go to another function, the array retains its structure but all the values are empty. I have no idea why it's doing this... though maybe it's some sort of scope issue? I've defined the array in the class, and everything is fine until I try to reference data outside of the function which it was put in. That being said, in a separate function, more data is added to the array and that data is still retained throughout the class.

View 1 Replies

Flash :: AS3 - Starting Function At End Of Another Function

Sep 12, 2011

I have an AS3 function that I need to end with calling another function.

[Code]....

I need to call this playMusic function at the end of it in order to start playing the audio track

[Code]....

View 1 Replies

ActionScript 2.0 :: Starting A Function After One Has Completed?

Aug 13, 2007

I have multiple functions in one frame. Each function runs an seperate animation. I would like to have the first animation run, and then as soon as that animation is complete, I would like to have the next animation play, and on so on.

Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
import flash.filters.*;

[Code].....

View 6 Replies

Flash - Calling The Function Within That Function And Later Stopping The Loop - Starting And Stopping Functions?

Jan 7, 2012

I am making a character walk. This code will make him wobble to the right and when thats done it will trigger him to wobble to the left and then call the function again to continue the loop.I can get the loop to work fine by calling the function but how do I STOP the function? Also I want to call it later on. Is there a way to start and stop a function?

function wobble()
{
var ws = .1;
var dis = 1;

[code]....

View 2 Replies

ActionScript 3.0 :: Math Functions - Starting Variable Status Strength With 10

Apr 23, 2011

I am learning AS3 and I try to remake an SimDate game. I have studies the functions and the Steps of the game and now I try to make the Functions myself.

I have 5 Attributes:
Strength
Knowledge
Charm
Health
Dollars

For each of them I have defined a variable. Now I need to make an math function. If I want to raise str:
statusstrenght = statusstrenght + addstr

This code is not the original. My other code is down below. I only wanted to show the process.
addstr == Math.random() *5
I wanted that the variable statusstrenght starts with 10. If I press the train Strenghtbutton the action addstr will be started and updates the statusstr with the new value. That's what I had in mind but I cant define the new value off statusstrenght + addstr. Do I have to add a new variable with newstatusstrenght or can I just overwrite the value of statusstrenght if I press the train strength button ?

Here is the code. The math functions aren't working. It is AS3.
import flash.events.*;
var statusstrenght:Number = 10;
var statusknowledge:Number = 10;
var statuscharme:Number = 10;
var statushealth:uint = 100;
var statusdollar:uint = 100;
[Code] .....

View 2 Replies

ActionScript 3.0 :: Starting Function From Within Click Handler

Feb 11, 2011

I'm trying to start a function from within a click handler that is being triggered when I load some XML, just like this:

Code:
function LoadSomeXML(e:Event):void {
thumbContainer_mc.addEventListener(MouseEvent.CLICK, thumbClick);
} function thumbClick(event:MouseEvent):void {
startImgSlider();
} function startImgSlider():void {
trace("ok, now you reached 'startImgSlider()' function !!!");
}

The problem is that I cannot reach the startImgSlider() function with the code above. How to do it right. Has something to do with the scopes?

View 3 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

String :: Flex - Download A String Variable As A File To The Local Machine?

Sep 21, 2011

I have a String variable in my flex (flash builder 4) application containing CSV data. I need to allow the user to download this data to a local file. For example, giving them a "csv" button to click and it might present them with a save file dialog (and I would be sending the contents of my string variable).Is this possible / how ?I am using the ResuableFX component for the datagrid to csv. This the code I ended up with that works to save the string to a text file for the user (in a web browser):

var dg2CSV:DataGrid2CSV = new DataGrid2CSV();
dg2CSV.includeHeader=true;
dg2CSV.target=adgEncounters;

[code]......

View 1 Replies

ActionScript 2.0 :: String Variables - Consentrate A String To Call That Variable?

Mar 16, 2002

If i have an ASP page that is returning variables (and I can see them in the debugger) how do i consentrate a string to call that variable?

ie:
variables being returned are named:
"res1", "res2", "res3"...etc
for (var i = 0; i < 10; i++) {

[Code]...

View 4 Replies

ActionScript 3.0 :: Starting A Pre Existing MouseEvent Function Without A Mouse Trigger

Dec 24, 2009

I've got an image gallery, that when the the image is clicked, it opens 2 images side by side like a magazine. Once the 2 images are loaded and visible, it makes visible 2 movieclips on each side to let you go to either the previous/next 2 images. Here's my code, I made bold the code that specifically relates to my problem. What I'm trying to do is when the button is clicked it either increases or decreases the imgCount by 2, and reloads the new images, but since the function I'm trying to initiate is triggered by a mouse event I don't know how to trigger it when the other function is triggered.
 
var imgCount:int = 1;
var imgLoader:Loader;
var lLoader:Loader;

[Code].....

View 3 Replies

ActionScript 2.0 :: 1 Btn-different Events - Btn Can Stop The Default Drive By Starting The Function?

Jan 19, 2009

PHP Code:[code].....

What I want to achieve is that the btn can stop the default drive by starting the function anhalten and then it should be able to restart with the function anfahren...I think this should go with if/else and bool-vars, but I could not make it work.

View 1 Replies

Regex :: Replace Portion Of String With A Variable String?

Feb 10, 2012

Trying to replace a portion of a string with a "-" if it matches a string variable in AS3.

var re:RegExp = new RegExp(imageArray[j][1],"gi"); trace(imageArray[jTemp][2].replace(re,"-"));

imageArray[jTemp][2] is a string imageArray[j][1] is a string as well I'm not getting the result I expect. I would like trace above to return 'permanentContainer-' Here are the traces for the above variables

permanentContainer-temporaryContainer- temporaryContainer

View 2 Replies

Actionscript 3 :: Flash Cs5: Set A Variable Using A Function, Then Read That Variable From A Different Function

Jan 29, 2012

I have a public variable and I am trying to set it, then read it from a different function:

public var str:String;
public function DailyVerse()
{
function create() {

[Code]....

My trace results says null. Why does it not give me "hello"?

View 1 Replies

Flex :: Adobe Flash Builder: Make A Function To Play Embedded Video Starting From One Second And Ending In Another?

Apr 16, 2010

Adobe Flash Builder: How to make a function to play video starting from one second and ending in another? So I havein MXML simple video player tag. I need some function to play that video from second X to second Y and pause it. How to do such thing?BTW: we asume file is embeded into SWF.

View 1 Replies

As3.0 :: Append A String To A Variable So Flash Reads It As A Variable?

Sep 27, 2010

i'm getting a value from a class that gives me e.g "icon1" as data. i want to use this within a function to control the visibility of an item nested in a movieclip on the stage. the nested movie has the same name as the data being sent.

// here's what i want it to do:
mymenu.icon1.visible = true;
// but i cant append the 2 together as flash will see it as a string not read it as path.

[Code]....

View 1 Replies

ActionScript 3.0 :: Change String Variable To A MovieClip Variable?

Oct 10, 2008

I have been banging my head against a brick wall regarding the following problem which must be very simple to fix, just can't see the answer.I have a class assigned to a movieclip called canvas. The class is called drawClass. I have called the instance of canvas on the stage 'drawingCanvas'.When I trace "drawingCanvas" I get object drawClass] which is fine. Tracing drawingCanvas.name gets me the instance name 'drawingCanvas'.This is a String variable.Basically what I am trying to do is pass the MovieClip name to another class. In my example the class 'toolBar', which can then interact with the MovieClip.

The problem is passing 'drawingCanvas.name' results in a String, so I get an error saying :TypeError: Error #1034: Type Coercion failed: cannot convert "canvasArea" to flash.display.MovieClip.I can't for love or money find a way to convert a String variable to a MovieClip variable! I have the name of the MovieClip, I just need to tell the toolbar class. But I can't find a way of doing this as the instance on stage is an object of drawingClass, not a MovieClip (unless MovieClips with attached classes are not treated as standard MovieClips?).

View 9 Replies

String :: Use Objects.function If Objectsname Is Taken From String?

Feb 6, 2012

I was wondering if this concept is doable:

Scenario:
4 areas on 1 stage which are quite similar (eg webcamconference, each area has the same functions)

Buttonobjects are numbered(eg area 1 has playbutton1,mutebutton1,namebutton1,namelabel1, etc)

every area gets a close-Button which closes/shuts down the area.(close1,close2,close3...)i want to archive the following:

if(close1.isPressed){
function invisall(1);
}[code]....

this should do the trick via dynamic Nr at the end of each default button(eg playbutton)
but ofc

"playbutton1"._visible=false;

doesnt work because playbutton1 is still a String.how can i take the String as a Buttonname /ButtonObject? do i need to write an new function? this would destroy the purpose of less code. for now i will split the area into frames that i put on the stage.

View 2 Replies

ActionScript 3.0 :: String Variable In Place Of Int Variable?

Jan 2, 2012

This is sort of difficult to explain but I'll do my best. I've got 6 score variables that go up over time.

[Code]...

Each corresponds to a different color of "Monster" class I reated. "GreenMonster", "BlueMonster", etc. are all custom classes. Each class has a string property called "MonsterColor". So "Blue1.MonsterColor = "Blue".

To save lines of code, and learn, I'm trying to use a local string variable to take the place of whichever of these 6 int variables I need. So inside a for loop, I've created a variable called "colorscore".

[Code]...

View 5 Replies







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