ActionScript 3.0 :: Get Variables From JavaScript?
Jul 20, 2010how can get multiple variables from javascript
View 2 Replieshow can get multiple variables from javascript
View 2 RepliesI am making a simple math quiz game that generates two numbers randomly and then the user has a keypad to enter the answer. I trace not only the real answer to each question but also what the user punches in and I even have it so that it checks to make sure the user's answer is correct.
What I need now is to find a way to export that data into an html page. I think I can do so with php, but I really need it to go into javascript. Does anyone know how I can send this data, either in a string or as integers to Javascript? I believe that the integers would be best.
[Code]....
how can i use javscript variables from flash as3
View 1 RepliesI have a simple standalone application written in Visual Basic that I'm porting to a browser based application using PHP/javascript. The original VB application has some simple embedded flash games with token and point counters. The token and point values are being passed as variables between the application and the game.
I'm trying to achieve the same effect in my PHP port without modifying the actionscript code( using the variables in actionscript that already exist). Below is Visual Basic code that's loading a value from a database and posting that value to flash using FlashVars:
[Code]....
[URL] In the following link .Is it possible to get the upload /download limit which is displayed on the screen to a javascript alert(uploadlimit) or alert(downloadlimit)
View 1 Repliesis possible to get variable from flash to javascript, php...for example in flash i have :var myVar = 25;how i can get variable ( myVar ) from flash to javascript ( jquery, ajax or php.. )smoething like myJsVar = myVar; ( from flash )or how to list all variables from flash to javascript ( jquery , ajax or php ), and how to set new variables to flash using javascript ( jquery , ajax or other );
View 1 RepliesIs there a way to get the names of variables from a flash game? I have been playing with my players health with the code;
javascript:document.embeds[0].SetVariable("_root.player.intHP", 0)
I am looking for a way to find out the rest of the variables, like damage and such.
In my Javascript I am adding a variable ('videoToPlay') in order for it to be passed to the Flash object with the purpose of using it to specify which video among a list of scrolling videos is to be played.
I am completely new to Flash and Actionscript and am finding it difficult working out how/where to retrieve my variable.
[Code]...
I have a text file at a remote URL which is populated by a javascript statement.The text file looks like this:[code]This loads in the txt file just fine, but it loads in everything.Is there a way for me to lose the "document.write(' 0 ');"and just send the "92" to the dynamic text box?
View 1 RepliesI've created a Flash app that calls on a php file to grab data from mysql, and returns it back to Flash. It runs just great on it's own.
The data-loading code looks like this, and works just fine:In AS3:
Code:
// Grabs the data from the MySQL db via a PHP file
var myLoader:URLLoader = new URLLoader();
myLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
myLoader.load(new URLRequest("data.php"));
[code]....
The SWF renders just fine on it's own, all data comes through.THE PROBLEM: Running that very same SWF inside of a custom Drupal PHP node does not work. I get IOERROR 2032 returning. I know the database connection does work just fine in Drupal because I take the above PHP code, apply it directly to the custom PHP node WITHOUT the SWF, and all the data spits out on the node page. For whatever reason, with an SWF which is inside of a Drupal node, the SWF cannot call on a PHP file for return data. I don't have time to figure this out, so...
Because I can successfully spit the PHP return data out on the same node page as the SWF, how can I transfer that data to the SWF on the same page?Instead of using URLLoaderDataFormat.VARIABLES in AS3, how would I call on a plain old array from javascript on the same page as the SWF?
How can I pass variables to be used on the page the flash is embed?
View 1 RepliesI have a flash player embedded on page page.php?user=john using swfobject. The player calls the xml file content.php to get the results. I'm trying to get the user name from the url id. and fetch results based on that. I can get the username on page.php by doing $_GET['user'], but how can i pass that to content.php. Having read allot of articles online, i did the following,I'm embedding the flash on page.php using swfobject like this
<script type="text/javascript">
var flashvars = {user:"<?php $_GET[user] ?>"};
var so = new SWFObject("<?php echo $index->CFG['site']['url'];?>preview2.swf", "sotester",
Does anyone know the correct syntax for setting a variable on _root using Javascript?
The Macromedia site says:
<!-- javascript
movie.SetVariable("/:varname", "varvalue");
However, this notation is quite old. I haven't been able to get it to work.
I am makeing a flash css generator to cusomize myspace profiles, I am up to the point where the full css code is generated, and then assigned to a variable. I am trying to make a preview button that will open a new browser window with a sample myspace profile but using the css defined in the flash variable. I can't seen to figure this out, I have found that the only way might be to use fscommands and a javascript gateway, but I am not well versed in javascript. Im at a standstill, I don't want to release my flash program until I have all its features operational, I have spent the last 2 weeks pulling allnighters from concept & design, to deciding features, and everyone who has beta tested for me says it can't compare to the other editors without a preview option. and I agree.
View 1 Repliesi`m trying to send variables from this .swf on level2 of the main movie to another swf that loads onto a javascript popup. i`ve tried using the GET and POST methods with no success.the popup script, first layer:
_root.btn.onRelease = function() {
address = "E01_p.swf";
target_winName = "test_pop";
width = 600;
[code]...
Does anyone know the correct syntax for setting a variable on _root using Javascript? The Macromedia site says:
<!-- javascript
movie.SetVariable("/:varname", "varvalue");
However, this notation is quite old. I haven't been able to get it to work.
i have:
[Code]....
I have this in AS3
var myName:String = "David";
var result:Number = ExternalInterface.call("methodInJS", myName);
trace("Result from JS call is: "+result);
[code].....
It appears that the flash variables are not accessible in Chrome when Javascript is turned off. Having said that, Youtube seem to work fine, when I test other sites like www.nhs.uk it does not seem to work, nor does mine.
I am using the most recent version of Chrome on Windows. Is there anything special that I need to target Chrome, how do I resolve this issue ?
I am making an audio player app that collects variables based on javascript running on the page. By default it loads 2 mp3s, but I need to be able to re-assign the mp3s that it loads based on different javascript clicks.
I think what I want to do is assign the default 2 songs to variables on file load. Then call a function that re-assigns those variables to the javascript variables passed in. My question is - how do I create a function that only runs on initial load? I assume I could then use javascript to call a different AS3 function to stop the player, re-assign the variables, load the file, and then start it again.
Here's my actionscript (compiled with mxmlc, embedded into html, and the functions are called with js):
[Code]...
I am looking for a simple and straightfoward example of how I can pass the value of a variable into flash using javascript.Specifically, I'd like to use javascript to pass the filename of an external video file that I would like to load into my flash movie.I'd also like to call a function in the SWF that plays the movie once the filename as been passed to the flash movie.External Inferface looks like the way to goI've found a few decent AS2.0 examples, but converting them to AS3.0 has proven difficult and many of the examples are much too complex for what I am trying to do.
View 4 RepliesHow To Run A Shadowbox Gallery From A Flash getUrl function Call..
This Is What I Have In My Flash:
btn1.onRelease = function() {
getURL("javascript:MyGallery([page1,app1]);", "_self");
}
I want to be able to declare my arguments in flash like so
var page1 = {
title: 'Google',
player: 'iframe',
[Code].....
I have a text file at a remote URL which is populated by a javascript statement. The text file looks like this:
[Code]....
myFile.load("[URl]"); This loads in the txt file just fine, but it loads in everything. Is there a way for me to lose the "document.write(' 0 ');"and just send the "92" to the dynamic text box?
The following doesn't work (although it gives no explicit error), but why not?nd... Is there really no way around it, strictly using the with statement? Forget using for / foreach.
with (object1, object2) {
attribute = value;
method();
}
Why the code above gives no syntax error, doesn't work but is accepted by with?If it's possible, how could we change multiple objects with same attribute using with?
var object1 = { attribute: 3 };
var object2 = { attribute: 2, method: function() { alert('blah'); } };
var object3 = { method: function() {alert('bleh'); } };
[code]....
I need to execute some javascript string code from flash swf file using actionscript 3.
I read that it could be done by passing the javascript code to the parent html document , using externalinterface.call function. Then I assume it will be faster if I can declare functions in the javascript code in the HTML document in the first use of externalinterface.call funtion ; if flash code calls the javascript code repeatedly. So let me ask you how to do that. For details , any javascript to be loaded is unknown in design time and I can not prepare a javascript file to be loaded.
for some reason, whenever I dynamically load a swf on a $(document).ready() by writing to a div, I am unable to make javascript calls to the browser. Specifically, all calls to the browser return "null". This does not occur when embedding the swf normally on the page load, but I would like to prevent loading of the swf until a specified point in time.
What the heck is going on here? Is there something special about dynamically embedding a swf that prevents the swf from talking to the browser? The methods ARE called (I've proven such by showing alerts), but all return values to any function, regardless of type returned, shows as null when it gets to flash.
Is it possible to pass file names from a running Flash application, which only purpose is to enable multiple-file-selection, to a JavaScript application which handles upload of all files to the server?I have examined various Flash upload solutions (like SWFUpload, Uploadify, etc.) and none of them meets my needs. I want an easy to implement solution (like Uploadify) which also lets me specify various parts of the HTTP request.
The reason I need this is because my upload form uses session cookies (for user authentication) and an CSRF token both passed to the server when uploading files.Is it technically possible to pass filenames (+ paths) to a JavaScript application which then handles the upload?
Here's the challenge: I have a Flash movie which will be embedded in a page using an unknown DOM ID that I want to be able to identify/store for callback in a JS function. My ideal user flow would be: User clicks button in Flash. Flash pauses any animations / video / sounds / etc. Flash calls an injected JS function to display a page-covering overlay experience. When user closes overlay experience, a callback method on the Flash object is called. Flash resumes playback.
The problem is, when AS3 uses the ExternalInterface.call("functionName", args...) method, there doesn't seem to be a DOM event triggered, and thus it is impossible to tell which object called a JS function, so having a "registerMe()" function doesn't seem to work. Basically, the injected JS function has no way to determine which DOM object to call, because the ID of the Flash object is unknown.
[Code]...
i have a flash movie with 2 frames. and i would like to call an external javasscript function on frame action.
[Code]...