ActionScript 3.0 :: How To Pass Variables Between Packages
Jun 23, 2009
I am working a xml-loader class. My aim is to split xml-loading process to two different packages. 1. XMLLoader.as load data from external xml files. 2. XMLProcessor.as stores the xml-data to the array for the further use. 3. Both packages are controlled by DocumentClass.as. 4. ContentMOV.fla is completely without code.Tree hierarchy is ollowing: quest01/website/classdocs 1. ContentMOV.fla is in quest01 folder, 2. DocumentClass.as is in website folder, and3. XMLLoader.as and XMLProcessor.as are both in classdocs folder.The DocumentClass path in fla-file is website.DocumentClass. "Browse to Path" is set from Edit/Preferences/ Language: ActionScript 3.0 Settings... to one folder before quest01 folder.
I have little experience on Actionscript 3 programming, but I just recently decided start working only with class-files. However, I am more familiar with visual basic programming (in Excel environment) and that affects quite much, how I try to approach to find solutions for programming issues. So for example, I am used to work with Global variables, but it seems that these Currently, the XMLLoader program opens the xml file and parse it to string. However, I am completely out of idea, how I can pass XMLDocument to the DocumentClass or XMLProcessor package. For example, I have tried following in DocumentClass: var XMLDocToEditmlDocument = new xmlDocument(); LDocToEdit.xmlDocument();However, these lines cause two errors in compiler: 1046: Type was not found or was not a compile-time constant: xmlDocument. 1180: Call to a possibly undefined method xmlDocument. DocumentClass.as is now as follows:
I have a swf with an input text box and a button. When the button is clicked, i need it to open another swf in a new window and pass the variables to a text box in the new window.
I have a variable in an as2 movie, urlwholoadedme =_level0._url; , that i need i need to pass to an as3 swf that gets loaded ((loadMovieNum("movietoload.swf", 1); ). what is the most efficient way to do this?
I am using CS3 and I write the following code as to pass variable to flash from PHP
Actionscript
var myLoader:URLLoader = new URLLoader(); myLoader.dataFormat = URLLoaderDataFormat.TEXT; var myRequest:URLRequest=new URLRequest("http://localhost/moodle/value.php");
I am trying to load an AS2 swf from an AS3 swf. The AS2 swf which was written long back, expects parameters from the timeline(_root). These were passed to it before from HTML using flashvars. Now I am trying to get rid of the HTML pages, by directly loading the AS2 swf from the AS3 swf. However, when I try to load the AS2 swf using the Loader class, the swf loads fine, but the parameters are not getting passed on.
I tried to add the query string to the url parameter I used in the URL request used for the Loader, but that did not work.(Adding URL variables as data to URLRequest did not work either.)
I want to have a button and when clicked, it does the equivelent of going to this php address and executes the php, as it would by typing into address bar. Simply activates php script with variables.
i like to know how do u pass variables from flash to another html. mine is just one simple variable.what i get from flash Help is using GET and POST(after declaring the variables)
I am generating a url from another application that looks like this: I am trying to pull the variable "mark" into a swf and display it in dynamic text box. The URL will change depedning on the user and I plan on adding additional variables to the string as well (lastname, state, age, etc).
I have a real simple request for some reason cannot pull it off. I have a url that looks like this: [URL]
I am trying to pull the variable "mark" into a swf. The URL will change depedning on the user and I plan on adding additional variables as well (lastname, state, age, etc).
I use actionscript 2 but would consider myelf a novice as I am more into design.
I have been grappling with this problem for days now. I want to set two variables in a SWF and have them passed to FlashVars PHP page. I can get it to work when I just send one variable with this code:
So I have an SWF8 file as a player on one domain (unsecure). It loads and plays an SWF8 from another (secure) domain. So far so good. Trouble is, I need the player to send variables to the files it's playing so that links in that SWF will, well, link. I also need the player to receive some movie control commands in return. There must be a rule or two I'm violating, because while the file plays, anything that depends on a variable is just dead.
A note: Both files started out as SWF6. I understand I can only do what I'm trying to with SWF8, so I went through the code and fixed the case sensitive issues and did the conversion.
I know PHP, JavaScript and AJAX. All of these other languages easily allow me to pass variables through a function, but I can't seem to work out how to do it in ActionScript 3. As you can see from the code below, I have created a variable called 'flag', this variable is set to 'notAdded'. However, once the function is called, I want to change the variable to 'added'. This for some reason does not work, the variable update only works within the function itself. There seems to be no global scope for functions.
Code: var flag:String = "notAdded"; bobRunning.addEventListener(MouseEvent.MOUSE_UP , bobRunningUp); if (flag=="notAdded"){function bobRunningUp(event:MouseEvent):void{ bobRunning.width = 30; bobRunning.height = 30; flag = "added"; }}trace(flag);
I am trying to load an image, with descriptive text and a back button on the click of a thumbnail of the image. I am using a MovieClipLoader instance to do this.
Here are my problems: I tried loading the image, with the text(which is within an external swf), using the same loader, but since I am placing them dynamically, depending on the dimensions of the image, I need to pass variables between the two. The image loader is taking longer than the text (obviously) but I need the dimensions of the image before I can place the text. How do I do that??
2. I tried using two loaders, with separate listeners, and the problem once again is that the text loads before the image, and is hence placed with default values instead of the values derived from the image. The code is within onLoadInit(). Is it possible for me to get the dimensions of the image from onLoadStart()???
3. There is a back button within the text.swf. I want the image and the text.swf to be unloaded when this button is clicked. How can I achieve that? Can I call loader.unloadClip(target), from within this? Will it recognize the variable?
Im having trouble receiving data from my php file using a loadVars object and sendAndLoad.Every variable is returned as "undefined". Here s my actionscript code:
I want to send the contents of a variable to a class where it can be used in its functions. Since I have no experience with object orientated programming what so ever I tried to break it down into real simple code so I can understand better what's going on and how I can implement it in my main code.I made a test file and a test class, basicly I just want to give a variable contents in my main code, then send the variable to the class so the class can trace it. But no matter how I try it i always get "Testoop.as, Line 6 1120: Access of undefined property test.Here is the code:
so this is the FLA: import Testoop; var test:String;
I would like to pass over 50 items of variables from php to flash. Actually I want to pass array with foreach statement, looping through the array and assigning loop index to the variables and flash again accept the php values through looping. Is this possible? If passing values through foreach or loop statement is impossible, I would like to break a new line in tag. how can I break a new line in FlashVars tag?
I made a drawing in Illustrator and exported it as FXG file to be used in my Flex App which is working fine. But now I want to change some settings inside FXG programatically, namely changing color inside the FXG file. How do I do that?
I'm trying to pass variables representing name and email address to a swf file. The swf takes a picture with the users webcam and sends the image to save.php for further processing. Currently I have text fields for the user to enter name and email, but I'd like to eliminate them and add the info behind the scenes. Basically this is what I'm trying to accomplish:
1.Page loads and stores name and email address in variables(index.php).
2.I'd like to pass name and email address variables to flash to be included with the image the swf sends to a php file for processing (save.php)
3.Page loads flash content(take_picture.swf) and does it's thing.
I've got this working in a similar situation using Zend AMF, where the swf gets all the info passed back from another page accessing the database. Here I have the data I need without accessing the database. I've tried many variations using FlashVars, but nothing has worked yet. One thing I seem to be missing is when I publish the fla, there is no ac_fl_runcontent in the html code Flash publishes. And there is no <embed src=... either. This div is the body of the html file Flash gives me:
I have 2 html pages. In the first one i have 3 buttons, which should open a second html page. Based on the clicked button the 2 page must open a different xml file( suppose 1.xml 2.xml 3.xml). So i need to say to the 2 page that it must open that xml file passing to it a string variable or something else. How can i do this with actionscript (or with flex).