Flash Link To Include .asp Variable In URL String
I'm trying to place a flash movie on an .asp page and have it append a server generated visitor ID on to the URL string of links from the movie to other pages of the web site.
My .asp page generates a variable "WID" by using the following code:
<%=sURLTOKEN%>
This code on the server causes an example url in the browser to be: "http://www.mysite.com/product.asp?productid=354&WID=%7BA76F3CB0%2DDA6D%2 D11D6%2D917D%2D0002B330452B%7D
I need to have the Flash movie read this WID and append it on to the end of any links from the movie to other pages of the site. Any ideas where I can find out how? I can provide more details if that would help.
Email me: mike@mikejacobs.org
Thanks.
--mike
FlashKit > Flash Help > Flash ActionScript
Posted on: 10-08-2002, 04:42 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
#include To Import A String?
Hi,
I'm trying to pull out random words from a string. Converting the string to an array and then pulling the words out randomly is fine. My problem comes with having the string as a seperate text file that I'm trying to import using #include, the string of words is big, so I thought it would be better to have it seperate and then import it. This is what I have so far "words.as" is the seperate text file
ActionScript Code:
#include "words.as"
newName = "words.as";
name = newName.split (",");
one_btn.onRelease = function () {
word_txt.text = name[ranNum];
word01_txt.text = name[ranNum01];
ranNum = Math.floor (Math.random () * name.length);
ranNum01 = Math.floor (Math.random () * name.length);
};
[F8] How To Include An "Add To Favorites" Link In Flash?
Hi everyone, I'm a new member to the forum as I am starting to learn a bit about Flash. I currently have Flash 8 and I am exporting everything in Flash 6 with ActionScript 1.0.
I am creating a website for a file hosting site and have stumbled across a problem. I have an "Add to Favorites" link but have no idea on how to get it to work, I have tried the following but first of all it has to confirm whether the user allows to run the script and second of all, it doesn't do anything!
on (press) {
getURL("'javascript:window.external.AddFavorite(lo cation.href, document.title);'");
}
Anyone have any idea on what I could do to solve the problem?
Regards,
James Venning.
EDIT: QUESTION SOLVED! I searched in a search engine I never use and it came up with the following article:
http://info.template-help.com/after_.../article6.html
Open Flash From Asp Link That Passes Query String
I am hoping this is easy.
How do you open a flash file with a link that is passing a query string? The flash file needs to evaluate data in the query string.
I am trying to open a record from a query by passing the ID to flash. something like ...myClip.htm?ID=13 My code in the movie would use the ID in the query string to pass back to an asp page that would run the query and pass it back to flash. I know it would be easier to stay in flash but the starting point is in an asp page. If there is an easier/better method I 'd love to hear it.
Variable #include
Hello,
I am looking for a solution to include a variable defined script file.
For example, if bubu = "001AM111"
I would need "001AM111.as" to be included. Maybe some eval tricks, but did not find it :-(
Any Ideas ?
For info, this is for localization needs.
Thanks in advance
Orico
Is #include Variable Possible?
I'm having trouble usinging #include to call a variable. Is this even possible? Like this:
var config = 'config.as';
#include config
It doesn't work. Of course, in my own project I'm doing something a bit more dynamic to determine the variable...but it doesn't do any good if this doesn't even work.
Thanks,
Kory
Using Variable With #include
Is it impossible to use variable with #include? It returns an error message when I write:
#include fileID+".as" (where fileID is a variable)
Since I have about 50 fileIDs which will share only one .swf.
Is there any alternative to do that?
Thanks.
#include Filename From A Variable
i would like to set the name of the file to be included dynamically.. i am running into a problem because it will not let me do double quotation marks:
whichFile = myScript;
#include """+whichFile+".as"+"""
trying to get it to evaluate it so that it ends up being :
#include "myScript.as"
any ideas?
Putting A Variable In #include
im trying to dynamically open a file dependant on a variable IE
i=1;
#include ["file"+i+".as"];
and flash hates me. is there ANYWAY to dynamically include a file?
also as a second question, is the a #include like command that will continue running if the included file is not found?
thanks
Include# With A Variable Filename
Hey Folks,
I'm getting an error with the following lines
//---
theVar = "GA_"
#include "c:/as_repository/" + theVar + "write.as"
//---
The file name should be "c:/as_repository/GA_write.as". This
changes for each state.
The error suggests that I have a "Malformed #include directive".
After reading that, I feel I should see a doctor.
Can one use the Include# statement with a concatenated string
like the one above?
I'm using Flash MX 2004 Pro.
Thanks,
Passing An Include In A Variable
I am trying to pass an include statement as a string variable.
This works fine:
PHP Code:
if(bottomEOW=="bottomOut"){
#include "bottomOut.as"
}
but I am trying to do something like this:
PHP Code:
//this variable gets passed into the function
bottomOutScript="#include "bottomOut.as"";
if(bottomEOW=="bottomOut"){
bottomOutScript;
}
The reason I want to do this is to be able to pass different includes into this spot in the function by changing the variable value.
Is it even possible to store an include statement in a variable like this? is there something simple that I am missing here?
Passing A Variable To Flash Via Url String
I understand how to get a variable into flash when it's hard coded into the html using Flashvars or this is how I do it with SWFObject:
where variable: location=subdirectory
Code:
<script type="text/javascript">
// <![CDATA[
var so = new SWFObject("featuredviewer.swf", "featuredviewer", "620", "480", "8", "#fff");
so.addVariable("location", "subdirectory");
so.write("logo");
// ]]>
</script>
What I don't understand and can't find is how to do this...
I have an html file with an swf in it. Different buttons in the file open a popup window via javascript. I want to pass a variable to the swf in the pop up window, possibly like this:
Code:
on (release) {
getURL("javascript:Launch('featuredviewer.html?position=one')");
}
But how do you extract the variable position=one out of the url and get it into flash?
Adding A Variable Directory To #include
Is there any way to include a variable in the target directoy of an #include statement?
This is what I have
------------------------------------------------
myExternalVars = new LoadVars();
myExternalVars.onLoad = function (success) {
if (success) {
{
#include "http://www.url.net/url/"+this.imagename+".as"
}
}
myExternalVars.load("http://www.url.net/dir/dir.txt");
-------------------------------------------------
and dir.txt has
-----------------------
imagename=var_var.jpg
------------------------
I have php that is writing the data from one swf and saving it to the variable actionscript file name.
now I need to load the data into another swf using the include method or something similar, because the output is also variable and massive.
Anyway, if anyone isn't too confused by all this. I could really use some expertise and any advise you can give..
Thanks,
John
Importing A String Variable To Flash Movie
Supposed situation:
Embed flash movie & a Real Player Plugin in a webpage.
Trying to completely control the Real Player Plugin using the Flash Movie for user interaction and let Javascript send all the requests to the RealPlayer Plugin(such as play, pause, stop, rewind, forward).
I know how to send a variable out of the Flash Movie by using the FSCommand to the JavaScript in the webpage. This allows me to control the RealPlayer plugin by play, pause, stop, and even which song to play.
Now the tricky thing is in the Flash Movie, how do I request and send information from the RealPlayer plugin to the Flash Movie in the webpage using Javascript? Such as the the Length of the song, the position in time of play, and other Statistics so I can display them all in the Flash movie.
Basically how can I Send Data from the Webpage Into the FLASH MOVIE?
Any suggestions.
AS 2 Problems Setting Variable From Query String In Flash...
I'm creating a banner for a client that pulls in images via XML (sub_banner.xml.php) and depending upon which section of the site the user is in, PHP writes a query string sent via flashvars to set which section images to pull in.
The URL for example, after the query string is set for 'conferences' section of the site will be: sub_banner.xml.php?headerImages=conferences
All the PHP is in place, I'm just having trouble setting the query string (headerImages) in flash. I've tried: var headerImages:String = headerImages;
My background is HTML/CSS based and still learning AS2 so any help is much appreciated!
Can Trace String But Cannot Set String To Variable
Hi,
I am importing a some text values from a text file and then trying to pass this value via a function
I can TRACE the text value successfully but cannot set it to a variable.
************************************************** **************
function test(){
var aTestVariable
myData = new LoadVars()
myData.load("thenews.html")
myData.onLoad= function(success){
if(success){
trace(myData.Title); //THIS WORKS
aTestVariable = (myData.Title);
}
}
return aTestVariable
}
function testFunction() {
trace(test()); //THIS DOES NOT WORK!
}
************************************************** **************
Can someone please tell me what is wrong with this:
trace(myData.Title); //THIS WORKS
aTestVariable = (myData.Title);
HELP!
Rich
How To Store A String Plus A Variable In A Dynamic Text Variable?
Hi,
I've got a dynamic text field with the instance name rightAnswer_txt.
I declare the variable in the frame it resides in, with the following code var rightAnswer_txt:String = "";
Then, when I want to populate it using the following code:
rightAnswer_txt.text = "You scored " + rightAnswers;
the script comes out with an error saying ...
**Error** Scene=Scene 1, layer=actions, frame=7:Line 15: There is no property with the name 'text'.
rightAnswer_txt.text = "You scored " + rightAnswers;
Any idea what this means anyone please?
Passing Variable From Link To Flash
Hello-
I had a question for passing variables from an html page into flash. Currently I have an index page that has various links that I want to attach a variable number to. Once the links are clicked, I will have a media player open up in a popup window and depending on the number in the variable will play a certain video.
Currently the media player initiates and plays whatever the current selected index is at, so my goal is to just create a variable for the selected index number and that variable will be dependent on the passed in variable from the link.
How do I do this? More specifically, how do I pass a variable from an html link into flash?
Sending Flash A Variable From An HTML Link
I've unsuccessfully tried using the Flash/JavaScript Integration Kit to build a grid that fades in and out markers depending on which link is clicked outside of the Flash.
I would greatly appreciate any help, as I've followed the directions 100%...
My fla and htm is in www.mildmedia.com/Grid.zip along with the Integration Kit files - http://weblogs.macromedia.com/flashjavascript/
Any other way to do this is welcome, too!
Much appreciated...
Change String Variable To A MovieClip Variable
Hi
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?).
Any ideas are most welcome. I'm sure I am missing something obvious.
Thanks for looking
Convert String Variable Into Movieclip Variable?
I have a variable called something like city_str which has a value of "toronto". I also have a moveclip (exported for AS) called toronto_mc.
What I want is a way of concatenating strings of "toronto" and "_mc" and assigning it to a movieclip variable called toronto_mc. Everything I try gives me a mismatch error in the compiler. I'm writing AS2 using Flash CS3. Any ideas?
Adding Code To Html Link That Passes Variable Into Flash?
Is it possible to add code (...html or php?) to an html link (i.e the link will be featured in an html website) that passes a variable into the flash site it links to? So when the site opens the swf turns to a certain page?
This will be necessary as there will be links to the site from different html sites and each will need to see a different version of a certain page
thanks in advance for any help
Pass Variable In Order To Link To Certain Frame In Flash Movie
i'm trying to pass a variable to my flash movie in order to make it go to and play a particular frame (referenced by its label in the actionscript).
i found the following on a message board and have attempted to implement it:
Here's a php example:
Let's say your external party wants to link to a frame label
"externalParty1"
Their html button would have this link
<a href="yourSwfPage.php?label=externalParty1&">Click here</a>
Now yourSwfPage.php has been sent a label variable in the query string which
is all you need. You will pass this on to your swf file like this in the
object tags.
<!--Your regular object tags here -->
<!--The variable which came in via the query string above -->
<!--is sent to flash from here via PHP -->
<param name="movie" value="yourSwf.swf?label=<?print urlencode($label);?>&">
And finally in your swf file you would have a method to manage the label
instruction
In yourSwf.fla have this on the first or second frame of the _root
//Did an external link come in?
if (typeof label != "undefined") {
this.gotoAndPlay(label);
} else {
//otherwise no external label so normal play
play();
}//end ifbut it doesn't seem to be working. is there a mistake in this information? can anyone advise on how else to accomplish this if this is not the correct way?
many thanks!!
Adding Code To Html Link That Passes Variable Into Flash?
Is it possible to add code (...html or php?) to an html link (i.e the link will be featured in an html website) that passes a variable into the flash site it links to (just something simple like '_root.pageChoice = "home3" '? So when the site opens the swf turns to a certain page?
This will be necessary as there will be links to the site from different html sites and each will need to see a different version of a certain page
thanks in advance for any help
Include 'samp.as' Ignores Include Folder?
It seems that "include" only looks in the host FLA files folder. Back in 8, I recall placing files in your (and I paraphrase:) "%profile%localappdataflashenconfigInclu de" folder allowed centralized access to as files. I really need this, I can't have a few dozen copies of this file floating around the project structure when I need to make a change.
I see that an Include folder still exists, but I can't include anything that's in it, even the files that live there by default. Adobe help for CS3 indicates that this folder's function remains unchanged, but I just can't seem to make it go. Am I missing something here? This is a fresh load of Windows XP and CS4.
I know I can write a class that handles what I'm doing and just make it the document class; but I'd rather not. Any thoughts?
(I am also concerned that I'll just run into the same problem with the Class folder refusing to play ball...)
Ebmed Link In String
I have a dynamic text box that pulls text from an xml file. I would like to be able to be able to link to another page when I click on some of the text. Is there any way to add some code to create this link once it is pulled into the flash movie or should I look for another option? Thanks a million!!!
String To Clickable Link
I'm loading in a string of text from xml to be display in a dynamically loaded text field. What I want to be able to do is make links throughout the text that use URLLoaders to load JPGs in to the interaction when clicked.
Any ideas on how to do this? Thanks.
Turning Dynamically Loaded XML Text String Into A Link
Thanks for your answer in advance.
I have completed a recent reconstruct of my website. http://www.harvestcry.org but have reached a stopping point and am in need of advice.
I am able to load movies and text from an external XML file. I use MX2004 and pretty standard XML file using SE/PY editor. I would like to change a portion of the text string read from my "content" childnode in my external XML file, to a simple link to an external URL or SWF file opening in its own window. What asfunction do I use and how should I insert it into the XML text string? Does XML use a standard HTML tag? Or is it modified
Here's my code:
import mx.utils.Delegate;
import mx.transitions.Tween;
import mx.transitions.easing.*;
var numOfItems:Number;
var radiusX:Number = 300;
var radiusY:Number = 75;
var centerX:Number = Stage.width / 2 - 50;
var centerY:Number = Stage.height / 2 + 75;
var speed:Number = 0.02;
var perspective:Number = 50;
var home:MovieClip = this;
theText._alpha = 0;
var tooltip:MovieClip = this.attachMovie("tooltip","tooltip",10000);
tooltip._alpha = 0;
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function()
{
var nodes = this.firstChild.childNodes;
numOfItems = nodes.length;
for(var i=0;i<numOfItems;i++)
{
var t = home.attachMovie("item","item"+i,i+1);
t.angle = i * ((Math.PI*2)/numOfItems);
t.onEnterFrame = mover;
t.toolText = nodes[i].attributes.tooltip;
t.content = nodes[i].attributes.content;
t.icon1.inner1.loadMovie(nodes[i].attributes.image1);
t.icon2.inner2.loadMovie(nodes[i].attributes.image2);
t.icon1.onRollOver = over;
t.icon1.onRollOut = out;
t.icon1.onRelease = released;
}
}
function over()
{
home.tooltip.tipText.text = this._parent.toolText;
home.tooltip._x = this._parent._x;
home.tooltip._y = this._parent._y - this._parent._height/2;
home.tooltip.onEnterFrame = Delegate.create(this,moveTip);
home.tooltip._alpha = 100;
}
function out()
{
delete home.tooltip.onEnterFrame;
home.tooltip._alpha = 0;
}
function released()
{
home.tooltip._alpha = 0;
for(var i=0;i<numOfItems;i++)
{
var t:MovieClip = home["item"+i];
t.xPos = t._x;
t.yPos = t._y;
t.theScale = t._xscale;
delete t.icon1.onRollOver;
delete t.icon1.onRollOut;
delete t.icon1.onRelease;
delete t.onEnterFrame;
if(t != this._parent)
{
var twTween = new Tween(t,"_xscale",Strong.easeOut,t._xscale,0,1,tru e);
var tw2:Tween = new Tween(t,"_yscale",Strong.easeOut,t._yscale,0,1,tru e);
var tw3:Tween = new Tween(t,"_alpha",Strong.easeOut,100,0,1,true);
}
else
{
var twTween = new Tween(t,"_xscale",Strong.easeOut,t._xscale,100,1,t rue);
var tw2:Tween = new Tween(t,"_yscale",Strong.easeOut,t._yscale,100,1,t rue);
var tw3:Tween = new Tween(t,"_x",Strong.easeOut,t._x,125,1,true);
var tw4:Tween = new Tween(t,"_y",Strong.easeOut,t._y,350,1,true);
var tw5:Tween = new Tween(theText,"_alpha",Strong.easeOut,0,100,1,true );
theText.text = t.content;
var s:Object = this;
twTween.onMotionStopped = function()
{
s.onRelease = unReleased;
}
}
}
}
function unReleased()
{
delete this.onRelease;
var twTween = new Tween(theText,"_alpha",Strong.easeOut,100,0,.5,tru e);
for(var i=0;i<numOfItems;i++)
{
var t:MovieClip = home["item"+i];
if(t != this._parent)
{
var twTween = new Tween(t,"_xscale",Strong.easeOut,0,t.theScale,1,tr ue);
var tw:Tween = new Tween(t,"_yscale",Strong.easeOut,0,t.theScale,1,tr ue);
var tw3:Tween = new Tween(t,"_alpha",Strong.easeOut,0,100,1,true);
}
else
{
var twTween = new Tween(t,"_xscale",Strong.easeOut,100,t.theScale,1, true);
var tw2:Tween = new Tween(t,"_yscale",Strong.easeOut,100,t.theScale,1, true);
var tw3:Tween = new Tween(t,"_x",Strong.easeOut,t._x,t.xPos,1,true);
var tw4 = new Tween(t,"_y",Strong.easeOut,t._y,t.yPos,1,true);
twTween.onMotionStopped = function()
{
for(var i=0;i<numOfItems;i++)
{
var t:MovieClip = home["item"+i];
t.icon1.onRollOver = Delegate.create(t.icon1,over);
t.icon1.onRollOut = Delegate.create(t.icon1,out);
t.icon1.onRelease = Delegate.create(t.icon1,released);
t.onEnterFrame = mover;
}
}
}
}
}
function moveTip()
{
home.tooltip._x = this._parent._x;
home.tooltip._y = this._parent._y - this._parent._height/2;
}
xml.load("icons.xml");
function mover()
{
this._x = Math.cos(this.angle) * radiusX + centerX;
this._y = Math.sin(this.angle) * radiusY + centerY;
var s = (this._y - perspective)/ (centerY+radiusY-perspective);
this._xscale = this._yscale = s * 100;
this.angle += this._parent.speed;
this.swapDepths(Math.round(this._xscale) + 100);
}
this.onMouseMove = function ()
{
speed = (this._xmouse-centerX)/9000;
}
Pass Variable With String From One Flash File To Another Flash File
There are two flash files which are developed in Flash MX 2004 Professional and its names are Main.fla&Child.fla.
I have created a Input text box in Main.fla and enter text during runtime. When I click a button in the same Main.fla file, the text entered should display in the dynamic text box which is created in Child.fla. But, I am not getting appropriate logic to achieve this task.
Request you to kindly send appropriate logic. It is urgent.
String To Variable? I Think? How?
HI,
Here's the line of code I need to fix up:
Code:
count = 1;
while (count<20) {
_root.dot0.duplicateMovieClip("dot"+count, count);
_root["dot"+count]._x = "x"+count;
_root["dot"+count]._y = "y"+count;
count += 1;
}
I'm pulling a bunch of variables from a text file that are x1, x2, x3, x4, etc. And when I duplicate the dot movie clip, the dot1 MC looks to the x1 variable for its _x coordinate, same for dot2 and x2, etc.
So, what I'm stuck on is how do I get...
Code:
_root["dot"+count]._x = "x"+count;
...to read as a variable so that my dots can find their coordinates??
I've looked in books, tutorials, etc...If I am making no sense, let me know. I appreciate your help =)
Jessica
Getting A Variable Out Of A URL String..
Several people have said that when you pass a variable
through a URL string that another flash movie residing on that page can use it because its just "there"
Im not feelin it
After many days trying i still cant seem to get my swf to pull and use that variable from the url string.
im using get and i see the variable in the url string..
i have specified in the embed code that "x(the variable i want in the new swf)= y(the variable in the URL string)
but to no avail...
can somone please help me as i seriously am about to smash my computer
well....maybe not that but man am i frustrated
-Thank you in advance
-JBOMB
String To Variable
Hello 2 all...
ok pretty simple question ..
I have a variable that 's a string but i also need to able
to take the string and turn it into a variable (not a string)
ex:
--
var menu
--
on (release){
menu = "Home"
}
---------
what i need is to be able to take the variable (menu)
witch is "Home" and turn it into Home so i can effect
a mc called Home.
I hope I'm being clear
this would save me from having to use 2 variables for the same word ...... help
up in smoke
mediamake
String To Variable
Ive got brain freeze. How can I change my string to a variable.
Basically I need this as a variable so I can call it from another part in a movie:
Variable _level0.instance2.instance3.test1 = "_level0.Question11Choice1"
I am getting that value by the following:
var test1=_root + "." +"Question1"+_root.QuizTrack.quest_num +"Choice1";
Any help would be greatly apprecaited.
Thanks in advance.
String To Variable
hello,
i want to convert an array string to a variable, that's already been declared, but I can't seem to make it work. I'm trying to get the number of objects in the array:
_root.sections_collections = new Array("Partworks", "Continuity Series");
//this code is in a movieclip
section = "collections"
foo = "_root.sections_"+section
trace (foo.length);
Any suggestions would be appreciated
Cheers,
Darren
String To Variable Name
Hi,
Is there any way to convert a string to a variable name? For example, lets say I have a sting called myString. The value of myString is "myVar". I also have a variable myVar which is also a string which has the value "hello". What I want to do is set the value of another var 'copyVar' to the value of myVar through the use of myString......confused yet....so am I. So really I want to evaluated the value of mySting as a variable name.
ex:
copyVar = Value of variable represented by myString.
Can this be done?
Any help would be appreciated.
Thanks,
Jeff
Variable Name To String
hi there,
got a problem with the following:
var vName is an array
// call a function
whatever(vName);
function whatever(info){
check if the first letter of the variable name stored in
"info" is a "v"
}
basically i am trying to retrieve the variable name of a variable
passed over by a function call, not the content of that variable.
i d appreciate any hint...maybe i am totally on the wrong track...?!
String That Is A Variable? Or Something?
Sorry if I'm not using the terminology correctly...
I want to put this in my flash 8 movie:
gotoAndPlay(<scene name>, 1);
<scene name> is a variable that gets set depending on which button they push. The actionscript helper is telling me that the scene name has to be in quotes. How do I make that dynamic and have the quotes?
Thanks in advance for being smarter than me!
Using A String As A Variable Name?
Not sure if this is a question that gets asked frequently, but Googling and looking on the Flashkit forum hasn't yielded any luck yet.
I'm wanting to use the value of a string variable to specify the instance of another variable. A simplified example:
PHP Code:
_root.Object.variable1 = "shadowrun.jpg";
_root.Object.variable2 = "bladerunner.jpg";
for(i = 0; i<2; i++) {
imageName = '_root.Object.variable'+i;
// do something with imageName
}
In this example, the value of "imageName" will be "_root.Object.variable1" and "_root.Object.variable2". I'd like for them to instead be "shadowrun.jpg" and "bladerunner.jpg".
Is there a function or language construct that converts a string to a variable name? Or is this just a poor route to take and I should rethink the way I'm coding?
String Variable
Hello,
I'm sure it cannot be difficult. How can I call String variable? I have no problem with boolean but in this case it doesn't work for me. Could you help me please, thanks.
Code:
mc1.onRelease = function() {
_root.my_change = "aaa";
};
mc2.onRelease = function() {
_root.my_change = "bbb";
};
mc_target.onEnterFrame = function() {
if (_root.my_change == aaa) {
mc_target._alpha = 50;
}
if (_root.my_change == bbb) {
mc_target._alpha = 100;
}
};
String(...i Think?) To Variable
Ok ... this is rather weird..something ive never tryed because i always set this using a script... I have this on a MC
Code:
onClipEvent(load) {
speed = 5;
}
onClipEvent(enterFrame) {
if (Key.isDown(Key.UP)) {
this._y -= speed;
} else if (Key.isDown(Key.DOWN)) {
this._y += speed;
} else if (Key.isDown(Key.LEFT)) {
this._x -= speed;
} else if (Key.isDown(Key.RIGHT)) {
this._x += speed;
}
}
that works fine... however... i also have a text field on the main timeline along with a MC.... with this on it.
Code:
on (release) {
_root.ball.speed = _root.test.text;
}
once again that works fine..... however this is weird... lets say i set speed to ....... 10 and I hit the UP key , the "ball"'s X value will go up by 10, so each time i hit up , 10,20,30,40,50 ... ect, HOWEVER when i hit the down key... it "adds a "10"" for example, if i hit up, and its X is at 10, it will then be at 1010, if i hit up again, its X will = 101010 ..... and so on.... so instead of adding the number 10, its adding a string "10" so it works when i use -= but not when i use += in the script......
Get The Value Of A String Variable?
I'm trying to make a function where a mc can pass it's instance name on _root into a function, on a key press, and then the function will get the name from the variable passed into the function and act on the mc.(sorry don't know how else to explain it).
EXAMPLE:
function moveRight(instanceName:string)
{
_root.<instanceName>._x+=5;
//where <instanceName> is the value of the variable instanceName;
}
I'm familiar with C++ and mel, just moving into OOP with as. Thanks in advance to anyone who can help me.
String To Variable
Is there a way to take a string that comes in through an xml document and turning it into a variable? I'm trying to make a quiz and would like it to just "see" whether or not there's an answer choice in positions c, d, and e. Example:
PHP Code:
<quizQuestion >
<ID>01</ID>
<question>What colors do laborador retrievers come in?<question>
<AnswerA>Black<AnswerA>
<AnswerB>Yellow</AnswerB>
<AnswerC>Chocolate</AnswerC>
<AnswerD>All of the above</AnswerD>
<AnswerE>null</AnswerE>
<image>null</image>
<CorrectAnswer>3</CorrectAnswer>
<feedback>Thats right. Labs come in all three of these colors.</feedback>
</quizQuestion>
I'd like to have it see that AnswerE and image aren't there and therefore the text area and loader would be removed from the stage. I believe this could happen if i can turn the answers into a variable.
Thanks.
Variable Name To String
This is probably very easy to do,
but i can't figure it out.
How do i retrieve a variable name to a string instead of its value??
Variable Name To String
I need to be able to get the name of a variable into a string variable.
eg
private function init():void
{
var test:int =53;
var getName:String = name(int);
}
private function name(var):String
{
return var.name;
}
I need this so that I can pull a variable out of an array without having to use quotes (eg "test").
This question has been asked a few times before but this functionality would really help make sure that typo's are not made when refering to the same variable in a different way.
String To Variable?
Hi, I'm trying to take a string and change it into a variable name.
I've seen two other threads but have a question. Say I have this:
var test:String = "testvalue"
this[test] = "testvalue2";
trace(this[test])
The result is testvalue2, as expected.
But why do I have to do "this[test]"? Shouldn't I be able to call upon the variable "testvalue" because that should be its own variable? I get a "undefined property" error when trying this. What am I missing or not understanding?
I've just started to learn AS 3.0 this weekend, so I'm still a "newbie."
Thanks!
|