ActionScript 2.0 :: Get A Variable Value From The Url In Which Its Loaded?
Mar 20, 2009
Is it possible for my swf to get a variable value from the url in which its loaded?
Example: If 'mypage.swf' is loaded in 'mypage.html' and its url looks like this:[URL]...then, is it possible to get the value of 'myvariable' from inside swf?I tried using this code on the first frame of my swf:
Code:
var myurl= this._url.split("?myvariable=");
var urlvalue=myurl[1];
... but it shows undefined
View 4 Replies
Similar Posts:
Dec 21, 2009
Working in AS2, using CS3 Flash Pro I've simplified this to just the one little thing I'm trying to do.
countervariables.txt has this text in it:
[Code]...
The trace shows itemsPerMili as 'NAN' and totalForYear as 'undefined'. I know itemsPerMili yields 'Not A Number' because totalForYear comes up undefined, but oddly, the loaded variable does show up correctly in a dynamic text field assigned to the variable. I don't understand why it should show up in the dynamic text field correctly when it won't trace.
I want to see the number "3.80517503" in my trace for itemsPerMili.
View 3 Replies
Sep 15, 2008
I have a problem accessing a variable loaded from another swf. Actually the variable is a singeltone class, which needs to be initialized.It has structure presented in the last part of the message.The project has the following structure:
- main.swf - this loads all the other swf files and is their holder.
- assets.swf - contains some common elements and initializes the SingleTone class
- interface.swf - contains some interface elements and needs to use the SingleTone class
- all the three swf files have access to a common class structure, where the SingleTone class is defined.
Now, the problem I have is accessing the SingleTone class from the interface.swf file. If I try to send the SingleTone.singleTone. property parameter to the class I get "Type coercion failed: cannot convert from ClassName@.. to ClassName". If I try to access the SingleTone class directly from the interface.swf file i get "Cannot access a property or reference of a null object...". Both errors I get seem logical:
- if I send a parameter, I send the reference to that object, but the interface.swf file does not have access to the assets.swf domain;
- if I try to access the SingleTone class directly from the interface.swf file, I get the null error because the class is not initialized over the interface.swf domain.
Is there any work arround? I know a simple solution may be to initialize the variable over the interface.swf domain, but what if there is a variable that can only be instantiated in the assets.swf? Can I access that variable from another swf, or can I change the ApplicationDomain?
View 1 Replies
Jul 2, 2010
I am sending a variable from my main swf into a loaded swf using the following code with its output at the bottom.I am having trouble getting my Course_ID_NO variable out of the function "inputid" in the loaded swf.
//-------Main swf
course_begin.addEventListener( MouseEvent.CLICK,cb_btn_click ); function cb_btn_click (e:MouseEvent):void { var mc_course:MovieClip; var request:URLRequest = new
[code].......
View 7 Replies
Feb 25, 2012
I am trying to place a condition statement so that it will only do an action if the swf loaded into the varaible is the same or empty. I start of with loading the sample1.swf into the movieclip swf_holder
Code:
var loadSwf:Loader = new Loader();
swf_holder.addChild(loadSwf);
loadSwf.load(new URLRequest(sample1.swf));
loadSwf.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
In order for me to get the sample1.swf to play, I create a variable so that I can just call on it
[Code]....
View 1 Replies
Jul 17, 2010
I have loaded a variable in a text file using the following code:[code]So, my text file has the variable called "volumes" and it loads into a text field named whose instance name is "ggg".Now the variable volumes is a number, and I want to use its value to determine the number of time a loop runs. Here is the code for that:[code]But this doesn't work. However it works if I define the volumes variable inside ...
View 1 Replies
Mar 5, 2011
Seems simple and I've searched but can't find the answer to this simple problem.
Loading map-.swf into main.swf. I want to use a variable from main inside map-1 to indicate which xml file to load.
First problem, I'm coming to AS3 and if a variable isn't declared, then errors, can't compile. So do I have to declare this variable in both swf files?
And well I've tried declaring the variable in the loaded swf and it still doesn't work.[code]...
View 3 Replies
Jul 27, 2004
i am using claudio's scrollbar to scroll an rss feed (compiled into an XML file). i have a variable h2 which is equal to the height of a box within the movie clip containing the scrolling content. the height of the box is equal to the maxscroll of the externally loading XML file. the box *does* resize properly (tested with trace), but only after the variable h2 is already defined... so variable contains the original size of the box and not the new size. how can i get the variable to update so that the entire external file can be seen with the scroller?
View 2 Replies
Dec 27, 2004
I have this dynamic menu that loads data from a xml file and loads a coprresponding movie. BUT, is it possible to set a variable as well OR instead so before the new movie gets laoded I can play something like a outro mc, check variables and then load the new mc?? Here`s the code:
[Code]...
View 2 Replies
Jun 24, 2009
I have successfully loaded an external swf inside my main swf. Now, I'm unable to try to trace a variable of the loaded swf from my main swf....
Code:
// Create site request
var siteRequest:URLRequest = new URLRequest('site.swf'); // 'site-' + siteAmbiance + '.swf'
[Code]....
View 6 Replies
Apr 7, 2005
I have been playing with this for a day and haven't been able to figure out the proper path to load this variable.So I have a main movie, a menu (movie clip) in it, and each menu option loads an external swf in a movie clip instance (called content) in the main movie.Loading the movies works fine.My problem is I want assign a variable that I have declared in a loaded movie in the 'content' instance.
Main Movie
|
- Menu (MC)
-onrelease -loads movie.swf, assigns defaultpage var a value
[code]....
Here is the onrelease code I'm using
on (release) {
this._parent.content.loadMovie("company.swf"); //this works
this._parent.content.defaultpage = "somevalueinhere"; //this doesnt
}
View 5 Replies
Mar 29, 2004
url...Where does the 'loaded' variable get set to False?I could only find it being set to True on the enterFrame function.Also, is there a more updated way to do what this tutorial is showing?
View 4 Replies
Nov 29, 2002
Can i check whether an external file exists?
I'm using this code to get the data from a file:
loadVariables(fileName.txt, outputBox); //outputBox is the instance name of the text box
i'm not loading any variables as such, but dumping the text in the file straight into the textbox
now i want to check if fileName exists
View 4 Replies
Jul 21, 2010
I'm trying creating a flash navigation bar that can be edited via a simple text file. I'm able to load my different variables properly but i also want to give the user the ability to remove links. I can simply leave the variable from the text file blank and and have the text in the swf disappear but i also want to be able to set the alpha of the movieclip behind the text to zero when the variable is left blank. Alternatively, even if the user could simply set the variable to the string "Blank" and both the alpha of the dynamic text and movieclip would change to zero that would be functional as well. Here is the code i have so far.
NavLoadVar = new LoadVars();
NavLoadVar.load("navigation.txt");
NavLoadVar.onLoad = function() {
[code]......
View 7 Replies
Jan 29, 2010
hi I have created an actionscript function which stops an animation on a specific frame which works fine. I have then loaded in a php file with a variable which will contain the number for the frame i want the animation to stop on. This has loaded in fine and i have loaded it in a function. what i cant seem to do is to get the variable into the function which tells the animation to stop playing.[code]
View 2 Replies
Nov 21, 2008
I know this has been covered, I've read every post on this forum but I just can't make sense of it. I would like to pass a string variable from a preloader swf to the loaded one. My code's on the first frame on the timeline on both swfs and I'm not using classes. Here's my code for the preloader:
[Code]...
View 7 Replies
Jan 19, 2009
In my main swf I set a string variable containing the name of the xml file that needs to load into an externally loaded swf file. How do I then pass that information into the external swf once it's loaded into the main swf? Is this possible?
View 4 Replies
Jun 25, 2010
I am comming from AS2, obviously. I have looked at many of the post people have to get "something" to be avaialble on a root type method, but I haven't found anything that has worked for this yetFor those who are saying "you're missing the point", and the rest of the "this is a bad idea" or "not needed" comments would you mind detailing the process of making a variable avaiable from a subMovie to a mainMovie and from mainMovie back to subMovie; or changing the property to an object inside of a SWF that has been added to a movie using addChild()?These are the constraints I have to work within. I can't restructure the 100-150 some odd pieces that are already in existance using AS3. New funtionality is needed that requires communication between the two movies.
View 6 Replies
Jul 20, 2010
So I'm trying to detect if a variable has been changed by a swf loaded into another swf.What I'm doing is when a thumbnail is clicked on the child swf I want it to fire a function on the main swf. I can get the model to trace out when the value was changed inside of the child swf by itself but when i load it into the main swf I can't get the onModelChanged event to fire off.Container swf as
ActionScript Code:
package {
import flash.display.MovieClip;
[code].....
View 1 Replies
Mar 29, 2004
I have a question about this Kirupa Tutorial: [URL] Where does the 'loaded' variable get set to False? I could only find it being set to True on the enterFrame function. Also, is there a more updated way to do what this tutorial is showing?
View 4 Replies
Apr 3, 2003
If a variable is declared in a movie as global (_global). Is this variable available to a movie which loads this movie via LoadMovie()?
i.e. parentMovie loads childMovie.swf
View 2 Replies
Nov 1, 2006
Why can't I assign a numeric value to a variable from a variable in a text file?
text file contains HowManyBands=3
actionscript is as follows:
loadNumVar = new LoadVars();
var NumOfBands:Number = new Number();
loadNumVar.load("Performers.txt");
[Code]...
within the if statement, the trace reports 3, however, if I try to use the variable later or trace it in the next frame of my video, it thinks it's 0. How can I get the Variable to hold onto the value throughout my animation?
View 3 Replies
Jul 16, 2007
I'm building a product page, here's the setup:
[URL]
On the index.swf is the main navigation that'll open swf's for the different categories. Those products.swf fills with products via php. This is the working code for products.swf:
ActionScript Code:
var t = "";
var cat:String = "products";
[code].....
Now my main issue is, I can't get the product_info.swf right. The problem is I don't know how you can define the products within the products.swf with a name, so you can tell which product you should display in the product_info.swf
View 5 Replies
Apr 17, 2008
I load a swf in my main fla and I want to pass the value of a variable from the loaded swf to the main fla.How can I do this in AS3?
View 5 Replies
Jan 19, 2005
I have a text file that set's some color values I would like to use in my flash movie. basically its a configure file for movieclips rollovers(set's the colors)[code]...
View 2 Replies
Sep 4, 2008
i am using flash cs3,i have a main movie that load many swf using a document class..i need to pass "userid" variable from the main movie to loaded swf so they can change their content dynamically.
View 7 Replies
Feb 13, 2011
I have a problem with listed code that every time I click on btn1 the variable (num) will be initialize to 1. so what is the best practice in my case to initialize the variable (num) for only one time when the flash loaded.
stop();
var num:Number =1;
function b1(event:MouseEvent):void[code].........
View 1 Replies
Apr 26, 2010
I have just uploaded my site for a recent project submission and coded my own preloader for it.The problem is that when I play the file (swf) locally it works correctly but when uploaded onto the internet the variable % is not loaded so says: loading... NaN%. The thing is that it works correctly other then that,when it is fully loaded the text and the preloader disappears as instructed. It just doesn't put a % into the percentage dynamic text box (which has instance name percentage and variable namepercentage).That is the site and this is the code for the preloader:
ActionScript Code:
percent._visible = false;
rotatemetom._visible = false;[code].....
View 1 Replies
Jan 19, 2005
I have a text file that set's some color values I would like to use in my flash movie.bascially its a config file for movieclips rollovers(set's the colors)my textfile reads as follow
Code:
textOut=0x3F6075&baseOut=0xFFFFFF&outLineOut=0xE19C14
My Flash is as follows:
[code].....
View 2 Replies
Apr 27, 2011
This has been driving me nuts. The short of it is that I have a main movie that loads smaller swfs. In the main movie, there is a textbox that holds descriptions of the smaller clips.What I am trying to do is this: When the user clicks a button in the loaded swf, a string variable "feedback" replaces the text in the description text in the parent clip.Here is the code I have. I have been searching this for a while now and have tried various things, so this may be way off base. The clips load fine and everything, I just can't figure this one piece out.I am only showing the relevant code because there is a LOT of other working code. If anyone needs more info, let me know.Main Clip
Code:
clipLoader.contentLoaderInfo.addEventListener( Event.INIT, onLoaderInit );
function onLoaderInit( e:Event ):void {
[code]....
View 5 Replies