ActionScript 2.0 :: Using One Variable To Write To Another

Dec 3, 2011

I need to have one variable contain the name of another variable so I can write the actual value using either variable.

On my main timeline I have this code:
var globalvariable = "blank";
On a movieclip I have this code:
on (press) {
var testsend = name._root.globalvariable;
testsend = "IT WORKS!";
trace(_root.globalvariable);
}

I'd like the trace to read "IT WORKS!" but it's always "blank". The reason for this is that I have a controls options page where users can change their key binding for the various controls of a game. There is a list of the actions in the game with a field for the currently assigned keyboard shortcut. When they press that field, it's a button that pops up a keyboard graphic which has buttons on it for every key. Clicking one of those buttons should assign that keyboard equivalent to the corresponding field.

So I want to have something like this actually work:
Click the MoveFowards field and click "Spacebar" on the keyboard graphic and now _root.Moveforwards has a value of "Spacebar".
Click the Jump field and click "Spacebar" on the keyboard graphic and now _root.Jump has a value of "Spacebar".
Click the Shoot field and click "Spacebar" on the keyboard graphic and now _root.Shoot has a value of "Spacebar".
So I need to pass the name of the variable to the keyboard graphic so that it outputs to the correct global variable and writes its output to the correct field.

View 3 Replies


Similar Posts:


ActionScript 2.0 :: Write A GotoAndPlay With The Addition Of A Variable?

Nov 25, 2009

So I've defined my variable:_global.current = 1;And below i am accessing an MC called 'carousel_holder', which has an MC named 'bar' and inside this MC is a final MC named 'bar1'.So ive tested my path and can hard code it fine, so its not a paths issue but i think my syntax is incorrect:_root.carousel_holder+".bar"+current.gotoAndPlay(" start");

View 4 Replies

ActionScript 1/2 :: Write / Read An External Variable?

Jul 9, 2009

I currently have a flash video player and I want to add some code that will update a variable in an external .as or .txt file. I then want to be able to pull this variable into a different .swf when required.
 
My variable I want to create will be CurrentVideo and it needs to be a number e.g. _global.CurrentVideo = 2

View 1 Replies

ActionScript 3.0 :: Write A For Loop For These Variable Declarations?

Mar 28, 2010

I want to simplify my coding of the below code: 
 
var printImage1:MovieClip = new PrintImage1();var printImage2:MovieClip = new PrintImage2();var printImage3:MovieClip = new PrintImage3();var printImage4:MovieClip = new PrintImage4();var printImage5:MovieClip = new PrintImage5();var printImage6:MovieClip = new PrintImage6();
  
I tried everything I could think of but it still gives me compiling errors.

View 5 Replies

ActionScript 2.0 :: Write A If Statement That Will GotoAndPlay According To That Variable?

Sep 22, 2005

In my movie I load a swf to a movieclip with this code


PHP Code:

 _root.ImageViewer.loadMovie("deneme.swf"); 

Now can I do this? before calling the swf named deneme. When I press a button If I attain a number to a global variable with this code

PHP Code: on (release) {_global.myVar = 5;gotoAndPlay("CloseUpAnimation");} 

Can I read this variable from the swf which I load into my movie?If I can read how can I write a If Statement that will gotoAndPlay according to that variable?

PHP Code:[code]...

View 4 Replies

ActionScript 2.0 :: Write To A Global Variable When In Specific Frame

Jan 27, 2009

When the value of _root.mc1._currentframe is 10 I want the value of _root.mc2._currentframe to be written (sent or changed) to a variable which I can use in mc1. So I want to be able to use this variable in different clips but I do not want it to be changed until the playhead in mc1 is in frame 10. However I do want the variable to be valid even if the playhead is not in frame 10.[code]

View 2 Replies

ActionScript 3.0 :: Flash - What's The Difference When Write A Temporary Variable

Nov 11, 2011

I would like to know what's the difference when I write a temporary variable like this (these are just examples): version1

[Code]...

What's wrong and right? Currently I write it like version 2 and I'm not sure if I should change it to version 1. I know most developers write like version 1 but I'm a little bit confused because I am totally unaware about version 1. If I use version 1 does that mean that my value is stored explicitly in a temporary variable that is cleared in every cycle?

View 3 Replies

ActionScript 3.0 :: Write A Function That Is Used By Multiple Buttons And Accepts A Variable?

Feb 11, 2009

i want to write a function that is used by multiple buttons and accepts a variable when it is called by a given listener..

ActionScript Code: this.fileBTN.addEventListener(MouseEvent.MOUSE_OVER, menuSet("fileMenu"));
function menuSet(what:String){
trace(what);//should trace back "fileMenu"
}

View 7 Replies

Actionscript :: Read XML And Write On List Write?

Oct 25, 2011

I'm trying to read a XML file and output the values, but i'm getting a 1120: Access of undefined property URLRequest. error.

[Code]...

View 2 Replies

ActionScript 2.0 :: Flash8 How To Write A Variable As An "if Else"

Apr 6, 2009

I have a set of questions then it shows the score. I want it to loop back to the questions to redo them if score is under 70 and loop to another section where the correct answers are shown if under 100 and over 70. I have 100 as a congradulations frame. The problem lies in the writing of the over 70 and under 100 part

Code:
stop();
question_text._visible=false;
ScoreText.text = "You scored " + _global.answeredcorrect + " questions correct ";

[Code]......

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

ActionScript 3.0 :: Variable Take Away Another Variable Which Makes Answer1 Variable

May 15, 2011

i have a variable take away another variable which makes answer1 variable i then want answer1 to be to the power of another variable how can i do this in flash

View 5 Replies

How To Write In Flash

Jul 31, 2009

I have received this big client wants a gallery built for this website. Problem I do not know how to write in flash. How to make a write flash file? Please help me this big client to work.

View 1 Replies

ActionScript 2.0 :: Write XML From This?

Aug 21, 2011

So I'm kind of an Actionscript/XML newbie, but I'll try to be as useful as I can:

I'm writing some code where I want an input text box to create a new node in my XML with that text as an xml tag.

View 9 Replies

ActionScript 2.0 :: Using PHP To Write XML?

Feb 6, 2006

I have a simple Flash/XML slideshow-esque presentation that uses images+audio.I want to hand it over to a client but I think managing the XML is too advanced for them.I'm thinking I might need to hand over an HTML form with some PHP to allow them to upload assets and add/delete slides. If I could make it in Flash, that would be even better. I'm thinking that if I do it in Flash, I can set an interval to keep reloading the XML in so the client can see their edits as they create a presentation.

View 3 Replies

ActionScript 2.0 :: How To Write % In Txt

Nov 20, 2007

I know there is rule how to write % so I can see in the loaded text from txt file.
So, how do I have to write "%"?

View 4 Replies

ActionScript 2.0 :: Variable + Variable = Variable. Sort Of?

Aug 29, 2007

Code:
var fruit1:String = "apples";
var fruit2:String = "oranges";
var fruit3:String = "grapes";[code]....

I need the variable fruit1, but for reasons I don't have time to get into, I don't know how to parse these two variables to make a parseable variable.

View 1 Replies

ActionScript 2.0 :: CS3 : How To Write This In Loop

Aug 1, 2010

write this in loop?

Code:

calendarday1._visible = false;
calendarday2._visible = false;
calendarday3._visible = false;
...........
calendarday42._visible = false;

I have 42 calendardays, I need them to hide them all at the same time.

View 1 Replies

CS4 :: Can't Write Code On Button Like M8

Oct 6, 2010

I am new to CS4. I have been using Macromedia 8 and used to be able to write code on a button very easily. So click on the button and go the actions. But How do I do it in Cs4?

View 1 Replies

ActionScript 3.0 :: Write Log File In It?

Oct 29, 2009

I've a flash project that's developed in Flash 3.0 and action script 3.0. My requirement is I need to print debug statementsinto a seperate text file. on the serverTo be in detail Let's assume that I need to print my debug statements inside the file can someone provide us with the sample codesnippet that prints stataments inside a text file?

View 3 Replies

ActionScript 3.0 :: Effective Way To Write?

Nov 27, 2009

Lately i've been trying to right in external classfiles to create everything and make everything work instead of stuffing everything in my timeline. So now i have made a classfile that first creates all the movieclips i wan't on the stage and then defines what all the buttons do.
 
But when i want to acces a variable that has been created in "createMc" from a private function i get an error, so i have fixed this by giving the var's a name and then use getChildByName().
 
But i think this looks like a really innificiant way off writing something and was wondering if it was possible to write this in a better, shorter, and thus more effective way.

[Code]...

View 5 Replies

ActionScript 1/2 :: Write A Log File?

Apr 27, 2011

I have created the flash exe which will be working on the local machine. what i want is to write a log file. How can i do it...? I have tried using

[Code]...

View 1 Replies

ActionScript 1/2 :: Read And Write To XML?

May 6, 2011

I have like 2 weeks already trying and nothingSo what is my gaol?ABOUT.SWF=========1. I want to know how to read a xml file into a dynamic text field.exmaple: about_us.xml into txt_about.CMS_ABOUT.SWF==============2. I want to know how to read that same xml (about_us.xml) so i can edit it and save it.

View 3 Replies

Flex :: Write My Own Flv Player?

Sep 13, 2009

how can i write my own flv player? Is there any specification ?i am now thinking to write my own flv player.

View 1 Replies

ActionScript :: Write Value To File Via Php?

Apr 6, 2011

I have some XML I've edited in ActionScript that I would like to save locally via php. My php script (called writeFile.php) is the following:

<?php
$variable = $_POST['data'];
$file = "tmp.xml";
$fh = fopen($file, 'w');

[code].....

However, no file is being created, and thus obviously nothing is being written to it.

View 1 Replies

Actionscript 3 :: How To Write On Screen

May 16, 2011

So I am creating a module and I have a screen that I need to be able to allow the users to write questions that they have on their screens in a text box. Does anyone know how to do this? This is the basic setup that I use for every screen:

[Code]..

View 1 Replies

C# :: Possible To Write Flash Content

Sep 2, 2011

I've been googling this for a bit but haven't come across anything definitive. Is it possible (by which I also mean practical) to compile Flash swf apps using C#?

View 3 Replies

ActionScript 2.0 :: Read And Write XML?

Jun 17, 2009

On load I want to read some attribute information including x, y coords for elements that will be positioned on the stage accordingly.

On moving elements to a new position I want the new coordinates to be written back to the XML file.

I understand AS can read the XML file OK but not write native. A php script is required to perform the write.

View 3 Replies

ActionScript 3.0 :: Shorter Way To Write This Out?

Jul 22, 2010

Is there a shorter way to write this out?

ActionScript Code:
var bytes:ByteArray = new ByteArray;
bytes.writeByte(0x53);

[code].....

View 3 Replies

ActionScript 3.0 :: Write Xml Into Flash?

Aug 13, 2010

I want to write my xml file into flash. how do i do that? My xml file is,

<?xml version="1.0" encoding="UTF 8" ?>
<graphs width="20">
<graph value="8.2" color="0xFDC13E"/>[code]...

View 1 Replies







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