ActionScript 3.0 :: Pass A Variable Between AS File And Fla File?
May 1, 2009How do I pass a variable between .AS file and .fla file?
View 7 RepliesHow do I pass a variable between .AS file and .fla file?
View 7 RepliesI have a movie player that works fine when i hard-code the url value in the video function, but when i try to pass that url/file path from an external file, the video doesn't load. I suspect that there is something i'm doing wrong with the quotes. What am i doing wrong?
[Code]...
I have a main in .as and I load .swf in my .as.It's Working fine,Now I want the take variable From .swf and Pass it Into .as.
My .swf file coding
function formatMessage(chatData:Object)
{
var number:uint = chatData.user;
trace(chatData.user);
[Code].....
I am trying to do is declare a variable in PHP and pass that variable to my flash file. Right now i am simply trying to do 1 easy variable, more will happen in the future but i need to figure this out first.I have used other forums and they say try this and that, but nothing i do seems to work. here is my code.
PHP Code:[code].....
I am trying to send a single variable from a flash application to a php file. The user input field in flash will send a variable to the php file for purging of the database. The following returns nothing. There is no error. I believe the error is in the php and not the flash. Here is my actionscript for the flash[code]...
View 7 RepliesI'm trying to pass a variable from my main swf to another one that's being loaded in a container in the main swf.I follow this Link,Its Working Fine,My problem is, if i declared the variable within the function i Cannot Access the Variable.
[Code]...
I have main in .as file, in that file i loaded the .swf file now i want to take the values from .swf and pass it into .as file how can i do this? Here my Coding !
[Code]....
I have a simple menu class for site navigation[code]...
I would like to be able to listen to the value of 'btnName' inside my .fla and respond accordingly.
Is it possible to pass this variable from an external .as file into my .fla?
What I want to do is load the contents of a file and sent it to an mxmlc compiler as an argument parameter. I can load and read the contents of a file using loadfile and setting a property value say propery="filecontent". But the problem is I can pass it into the mxmlc (flex) compiler. I'm not able to pass it (tried with ${filecontent}) to the arg line. Its gives an error: "value contains unknown token 'filecontent'" How will I pass the contents of the file as a argument value to a compiler argument? Edit: The problem is with the include-resource-bundles arguments. When using command line it works. But using ant build doesn't. Do we need to manually provide the name of resource bundles by generating the resource file?
<exec executable="${MXMLC}" dir="${APP_ROOT}/src" >
<arg line="-locale 'en_US'"/>
.. .. ..
<arg line="-include-resource-bundles
[Code]....
which doesn't work and gives and error -> command line: Error: configuration variable 'include-resource-bundles' value contains unknown token 'resources'
I'm beginner in actionscript 3, and I'm trying to pass a variable from the main fla to external as file.
View 1 RepliesI am adding some movieclips dynamically to stage. If we click on the movieclips, they goto and stop at frame 2. The Click Event for the Movieclip is defined in the base class
Code:
package {
import flash.events.MouseEvent;
import flash.display.MovieClip;
[Code].....
But, I cannot figure out how to get the name of the movieclip.
I cannot add click event for movieclips in flash, because there is already a click event in the class file.
I want to pass a string variable to a SWF so that I can specify a XML file to load without republishing the SWF. When I assign the string variable to a textfield it is correct.But when I use that variable in the loader it does not display the XML from that file.You can see below that I commented out the string "lesson_11/images/0301_objectives.xml".If I put this string in the loader it works, if I use the string variable in its place it does not work.
Code:
var xmlFileToLoad:String;
var myQueryString:Object;
[code].....
I need to pass a variable value contained within a MovieClip to my class file. The MovieClip is my preloader, to which my code will show that upon the initial launch of the SWF. Until the variable is sent, my code assumes the preloader is still running and therefore will not progress. Originally, it was working when I had my class file extend MovieClip and then used this code in the preloader MC:
[Code]....
I'm trying to create a simple SWF file that can receive the name of a FLV file in the HTML file and play it since I have many FLV files. Basically using the technique of FlashVars. I've set the contentPath/source in the components to be blank, and set my actions in the first frame to be player.source = filename, as was instructed to do so in a Flash book I am reading. I then set the "filename" variable to a file in the same path as the web page in the HTML file, however, all I get is a blank Flash player skin. The FLV file will not load. I also tried setting the "filename" variable to load the FLV from a public website in the same domain and on another domain, but it still doesn't work.
View 5 Replieshow to pass variables from one Movie clip's AS file to my Main AS file. Let say my Movieclip's AS file is calling damage = 1; so how the Main AS file retrieve the damage value from the Movieclip's AS?
Code:
public class robotMC extends MovieClip
{
public function robotMC()
{
[code]....
I have basic knowledge of Flash and AS3.0. Suppose i have a flash swf file(main.swf). In this main.swf file, i loaded another swf file(sub.swf) by writing the following code snippet in main.swf file as shown below:
var textLdr:Loader=new Loader();
var noteUrl:String = "AddNote.swf";
var noteUrlReq:URLRequest=new URLRequest(noteUrl); textLdr.load(noteUrlReq);
addChild(textLdr);
Now, how to acess the data present in main.swf into sub.swf.Note: Here data represents values/data stored in variables/objects of main.swf file.
I have a problem with SharedObject. I created SharedObject using AS2.0 it's working fine.... my question is can it possible to store the variable values in an .txt file where the flash file is saved... basically the SharedObject will store the vallues in localdrive with file extention. not only using SharedObject if any other way to store the vaules in .txt file will be helpfull for me... my requirement is to store the the position of the swf file and when the time it reopen, it should start from previous position.
View 2 Repliesi want to load variable from text file to my main movie (swf file).what should i put in the second parameter of the function loadVariables ("target" parameter) - should i insert _this? _parent? _global? (nothing works.
View 3 RepliesI have trouble passing a variable from HTML to Flash.I use swf-object2.2.how to code the variable in the html-file and how to receive it in the as-file?Its a simple shopId = 110
View 3 RepliesI am trying to create a simple form using Actionscript 3 that will collect data from a form, then pass that data to an asp file. I have attached the following code to the submit button,but this is not working.I'm not sure if I have to add anything else and I don't understand why this is not working. I'm trying to load all the variable info into one variable called email form.
submit_btn.onRelease = function() {
var emailform:text;
emailform.email_txt = email_txt.text;[code]......
I have a task to upgrade a web site. I have a map of ND with some cities on it. I needed to add a new city to the SWF which did not seem to be hard (asuming I did it correct). The action on all the buttons for each city look like this except the name after the # is the city selected.
on (release){ getURL("locations_info.html#minot", "location_content");}
In HTML code snip that controls this looked like this :
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
[Code]....
i have a function(initialize) inside the a.as File.i want to access the that Variable from aaa.fla file?.How Can i access the Variable?my main class is a.as file ,inside a.as file i load the aaa.swf file
public function initialize(parameters:Object, stage:Stage,
loaderInfo:LoaderInfo, pluginHostWhitelist:Array):void
{
sourceId=loaderInfo.parameters.src;
[code]....
My aaa.fla Its in Another place
import fl.motion.ColorMatrix;
import flash.filters.ColorMatrixFilter;
var sourceId:String// here i want to access the "sourceid" variable from a.as file
trace(sourceId)
i have a function inside the a.as File.i want to access the that Variable from a.fla file?Both are Different places.But i load the a.swf into a.as.How Can i access the Variable?
ActionScript Code:
function initialize(parameters:Object, stage:Stage, loaderInfo:LoaderInfo, pluginHostWhitelist:Array):void
{
[code]....
I am trying to pass XMLList from one class to another class using public function get.
Below is the code I am using.
XMLContents.as
ActionScript Code:
package com.ad.loading
{
/**
* ...
[Code].....
The problem is I get a "null" on trace.
I have the need to change a variable in a child Flash file.
The setup is a parent Flash file, that has called a child Flash, and placed it in a movieClip.
I can send a variable using Javascript to the parent Flash file, but not directly to the child Flash file. Is there a way that I can access the child Flash file directly with Javascript?
Or do I need to send the variable to the parent Flash file, and then have the parent send the variable to the child Flash file? Is there a sort of dot notation that I can use with Javascript to get to the child Flash file without first accessing the parent, when the child is added to the parent using the loadClip function in flash?
For some reason i am not able to pass a value to a php file and display it..My actionscript code:
Code:
m_t = "hello world";
getURL("http://localhost/reg_vis.php?m_t="+m_t, "blank");[code].....
I have successfully created a php file that reads and echoes the contents of a directory in the string [code]...
View 4 RepliesI've created a very simple video player that I want to use with many different FLV files on my site. Rather than packaging SWF files with each FLV, I'd like to just design one SWF file and have the corresponding HTML file pass the URL of the FLV as a parameter to the SWF. I've read a lot about passing in parameters from HTML to SWF using AS3, and it seems pretty straightforward. Here's an example of the code I created using Flash CS3 and ActionScript 3.0:
this.loaderInfo.addEventListener(Event.COMPLETE,loaderComplete);
function loaderComplete(evt:Event):void {
//traceText.text = "Loaded";
[Code]....
Note that I'm using the variable "userName" to pass the parameter. Eventually I'd use a variable like "movieURL" to convey the actual URL of the FLV file. In any case, when I run the code, I get ... nothing! Nothing but a blank text box. Both the HTML and SWF files are on my local machine.
If I uncomment the "//traceText.text = Loaded" line, the text box says "Loaded", which would indicate that the event listener is functioning properly.
I have created an external actionscript file, which is called from Flash with the command#include "my_script.as"
The question is: how can I pass variables from Flash to the external actionscript file?
I'm trying to pass an array from flash to my main class in AS3. This is an array that contains a string of positions (x,y)...to add it to main array that will be a SO..
Code:
savePoints_btn.addEventListener(MouseEvent.CLICK, saveBezierF01);
function saveBezierF01(e:MouseEvent)
{
[code]....