ActionScript 2.0 :: Loading Vars From Text - Global Link
Aug 3, 2004
I have a load vars function that looks for a txt file and grabs data from it, right now they have to be in the same dir. I'd like to have the txt in the root of my server and then be able to link from any dir in the site. I have:
("dataValues.txt")
What should I add before it, I thought maybe a full URL, but no, is it something like ("../dataValues.txt"), basically I want to make the link global for the site - I don't have access to the files right now.
OK I have defined a variable sayPHP Code:test="what should I do?" then I have a textfield with var name "test". Now when I play the movie it will display "what should I do?" in the textfield, but what if I put the textfield inside a button? It won't show! How do I change the actionscript so that it doesn't think that the field is in _.root??I tried this:PHP Code:button1.test="whatwhere button1 is the instance name of the button!ut this won't work
i have an swf called movie1, on the main stage of movie1 i have a mc that is named xpos,inside xpos i have a dynamic text box and it's value is asigned to the Var=clipX.to get the value of clipX i used this code in the actions of xpos like this:
i have an swf called movie1, on the main stage of movie1 i have a mc that is named xpos, inside xpos i have a dynamic text box and it's value is asigned to the Var=clipX. to get the value of clipX i used this code in the actions of xpos like this:
I have this code in a movie, the movie loads fine on it's own but when i load it into another movie it does not work. I think this is to do with global vars, but im not sure. look at the code to see if it is the case. how and where i would change the vars so they are global vars.
From all the documentation and examples I can find, it appears that it would be correct to create a global array variable [outside of any functions] to load image names into, then use these images for a slideshow. I want to make the app dynamic, in that changing the text file gives a new set of images.
The global variable goes null [no values] after the load event listener. Why is that?
Isn't global, well global, and alive for the duration of the SWF?
pros and cons of either using a Singleton that enforces only one instantiation of itself, versus creating one common class with static vars which can be accessed by all other classes that import it?
In my testing, importing but never instantiating works fine. I can even change the value of one of the variables and then have another class see that changed value later on in the program.
If I *know* I will never actually create an instance of my Global class using the New command (but will instead just reference the variables using the class's name), then why should I need to make it a strict Singleton?
I have this textfield in wich i load some vars when a button is clicked. How can i make a sort of button of the loaded vars? So if i click on the first title; i go to the right txt-file!?
Here's the code so far:
code: //vars instellen //titels var title1:String = "Maan Fotografie"; var title2:String = "Vertigo-/zoomeffect-fotografie";
Have a thumbnail image acting as a button - sitting on my HTML page.When the user clicks it, the button uses the POST method to send a specified variable.I think I can handle the variable from there using javascript - which will talk to my embedded swf.
I am doing a Flash header where button text and links has to be easily configured by the owner, so i'm thinking the smartest way is to load button text + link from an xml file.There will be 7 horizontal buttons. The name of the button will be loaded into a dynamic textfield i guess, but what about the link?Im fairly sure it's possible to make an animated button and load an html link into it's Actionscript... but how?My XML would look like this:
When I run the flash from my local host (using XAMPP) it all works fine. But when I put the whole thing onto my online web server and change the URL to access the php file, its just coming back as "NaN" ...so why does it work on my local server but not the online one?
ok I have a load vars function that looks for a txt file and grabs data from it, right now they have to be in the same dir. I'd like to have the txt in the root of my server and then be able to link from any dir in the site...I have: ("dataValues.txt")what should I add before it, I thought maybe a full URL, but no, is it something like ("../dataValues.txt"), basically I want to make the link global for the site - I dont have access to the files right now so I cant just try a bunch of stuff myself.
i'm trying to fill out dynamic text fields by adding to my url like so:url...if the url could link to the html in which the swf was loaded instead of to the swf directly, that would be even better... but that might or might not complicate things (i don't know)
loadVariablesNum("produkter.txt", 0); import TextField.StyleSheet; var myCSS:StyleSheet = new StyleSheet();
[Code]....
and a dynamic textbox called "myHTML". If I name 'var' on this textbox everything works fine, but I want to write it in actionsscript instead. Where do I write that? (I have 3 different vars in the text-file)
it gave me error like this: ReferenceError: Error #1069: Property jumCust not found on String and there is no default value. at loadPHP2_fla::MainTimeline/loadedData() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at flash.net::URLLoader/onComplete()
I have tried repeatedly to sendAndLoad variables from/to flash and php. The problem actually comes when passing the variables from php to flash, here is the flash code:
var dataOut:LoadVars = new LoadVars(); var dataIn:LoadVars = new LoadVars(); dataOut.username = _level0.usuario.ss.s1; //passing the value of textbox dataOut.pass = _level0.contrasena.ss10.s10; //passing the value of textbox [Code] .....
I have omitted some mysql code, but it would still work this way. Which is most odd is that when I test the movie in my computer it works perfectly, but when I upload it to the server it doesn't work anymore.
I have it when the user clicks on a link it loads the php ?page=portfolio, in portfolio.php i have a peice of code that writes "var=portfolio.swf" to a .txt file Actionscript loads the text file and grabs the var, which is sent to the preloader which loads portfolio.swf. The problem with this is the Flash cache, you have to open a new window to see the portfolio.swf loaded and the second problem would be clients fighting over the .txt file.
What I want to do is, eliminate everything on the client side (the txt file) and make it so flash picks up the vars from ?page=portfolio and directly passes that to the preloader.
I heard this can be done with FlashVars, its kinda hard for me to understand could some direct me to an example code of FlashVars that I can play around with.
i am having trouble loading multiple variables into a multline textbox. I am using asp which will output a recordset into flash. For testing purposes var0 should equal three names in my array. Flash is only reading 1. How do I set flash up to read that whole array(3 variables in one textbox)? I know Flash won't output var1 or var2 because I don't have those textfields with those variable names.
i am having trouble loading multiple variables into a multline textbox. I am using asp which will output a recordset into flash. For testing purposes var0 should equal three names in my array. Flash is only reading 1. How do I set flash up to read that whole array(3 variables in one textbox)? I know Flash won't output var1 or var2 because I don't have those textfields with those variable names.
I built this site out in as2 and have to convert it to as3. It appears the same logic flow and coding just doesn't apply since everything has changed on an event level. The idea is to load thumbnails dynamically and upon clicking the thumbnail retrieve the loaded variable (i) in the array per the XML loop. I'm trying to figure out what I'm doing wrong in logic flow as it keeps coming up "undefined" or pulling up the last one after the whole thing's loaded. I'd copy the exact code but there's a lot of variables. So I'll post this basic structure to give an idea of what I'm doing. The bold print is where I'm stuck in terms of getting a trace.
I have a flash file which loads in vars from director. It then adds the values to a graph. The amounts from the string are inputed into text fields. the fields are named energy, waste etc. I want a textfield to output whichever sections that are over 5 saying "well done, you have excelled in water, energy...... I have got this working but am stuck on this bit: I am wanting to add an "and" before the last item, so it outputs as "well done you have excelled in water, waste and energy". Also if only one item is over 5 it wont add the "and". This probably doesnt make any sense, heres my code anyhow:
Code: var summary_results = "2000,6,3,10,8,6"; var txtFields:Array = [Total,Energy,Waste,Water,Food,Transport]; var excelledItems:Array = []; var theValues:Array = summary_results.split(","); for(var i=1;i<theValues.length;i++){ [Code] .....
The XMLdata doesn't seem to be global when this code is executed and I am not sure why. I want to load the data but it may not be used to later by the user.
//Load XML var xmlData:XML = new XML(); var xmlLoader:URLLoader = new URLLoader(); xmlLoader.addEventListener(Event.COMPLETE, LoadXML); xmlLoader.load(new URLRequest("XML/organtext.xml")); trace("loading xml from XML/organtext.xml"); function LoadXML(e:Event):void { trace("XML Loading Complete"); xmlData = new XML (xmlLoader.data); }
My problem is that when I load this swf into another one it won't run and I get the error://Renderer (WARNING) :: startEnterFrame :: Unable to add a listener to the enter frame event because a global stage reference does not exist.The animation classes require that I add a global stage reference and I have added that in my main App class that is the document class in my animation swf like this:AS]import com.boostworthy.core.Global;Global.stage = stage;[/AS]This works fine when the swf runs on its own but when I load it into another movie I get the error mentioned above. I've tried setting this reference in different classes (my animation swf uses a number of classes) but no dice. I think that I might need to pass a reference to the stage from the top-level movie to the animation swf though I don't know how to do this.I have tried like this:
[AS]//code on top level movie var myApp:App = new App(this); //code inside App class (main class used for animation)
I have some filters set up, and have assigned some global vars to them, which I then use in my Filters code to display the filters: myText:Filters [globals.data.glow1, globals.data.stroke1, globals.data.shad1] Works perfectly. Now I want to assign a global var to each global filter var to determine if it should be shown or not. So...