ActionScript 2.0 :: Retrieving Variables Set In Javascript?
Jan 17, 2011
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]...
View 9 Replies
Similar Posts:
Feb 8, 2006
My basic need is the ability to show a flash video only once per browser session without using Server-side technologies to track the session.
I originally tried using Shared Objects and they work well, but I could not figure out how to make them expire when the browser session ended. I could set a date variable in the Shared Objects and play the video again if the current date was more than an hour (or 30 minutes or whatever) past the previous play time, but I would rather have the shared object "expire" when the browser session ended.
Cookies could provide this functionality, but I have been having trouble retrieving Javascript based cookies in Flash (using getURL and document.cookie). If you do not set an expiration on Javascript cookies, they will expire when the browser session ends.
Here's the code I have been trying to get working for Javascript cookies in Flash:
ActionScript Code:
function GetCookie(cookieName) {
js = "javascript:function gc(){";
js += "var s = '" + cookieName + "=';";
[Code]....
The SetCookie function works, but the GetCookie function is always returning an empty sting.
View 9 Replies
Feb 13, 2009
I want to get the variable-value name pairs from an object. Anyone has got an idea how to do it? The name-value pairs are always different, not even the same lenght. I need an universal loader
[Code]...
View 0 Replies
Nov 9, 2009
I'm not even sure if this is possible, but I'm looking to retrieve a string from an embedded XML file, using a variable as the XML element's name. Here's what my code currently looks like, although it doesn't quite work:
Code:
private final function getAreaTitle(_index:int):String
{
var _element:String = map_XML.mapnode.@title[_index];
[Code]....
I'm not massively familiar with the XML format, so apologies if I've not explained myself very well. As you can hopefully see, I have one XML file containing my map data and another containing my text, such as area titles and locations. What I'm trying to retrieve in the example above is the string with the label "title_training" from the "text_XML" file. Of course, the function should be able to return the title for any area, so I need to find a way of converting "_element" in to the right format
View 1 Replies
Oct 25, 2010
This all is for a Highscoretable in flash. I'm trying to set up a function to retrieve variables from a PHP echo. The echo reads like this:
[Code]....
View 3 Replies
Jan 24, 2011
how to load array variables from a mySQL database using PHP and Flash.(I don't know much about PHP and mySQL, that's being handled by another person for the project I'm working on with him.)My code compiles, however when I enter the url that the php is located at [URL] and press the but to retrieve the variables, I get this error:
Code:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at loaders::Retreuvak/loadvars()[C:UsersuserDocumentsflash est_filesloadersRetreuvak.as:33]
at Load_test_main/doIt()[C:UsersuserDocumentsflash est_filesLoad_test_main.as:30]
I've looked it up and apparently it's most commonly received when someone is trying to reference a movieclip that hasn't been loaded or added to the display yet, however since I'm not even using movieclips.
View 3 Replies
Apr 1, 2012
I have created a loader class that retrieves variables from an external text file. I call the loader class and all works well but I cannot figure out how to retrieve and use the variables in the Main class.
[Code]...
View 3 Replies
Jun 11, 2011
I am downloading a flash video with Perl. Is there a way to interact with the flash video like retrieving variables from the flash video, like you can do in C#?
For instance, in C# you can put a Shockwave Flash Object on a form and then you can do GetVariable/SetVariable on that object. I don't want to/don't care if I can see the video, I just want something like the Get/SetVariable of the C# Shockwave Flash object.
View 1 Replies
Mar 24, 2007
i've been setting up a high score table in my game, and everything is working, but i cant work out how to get variables from the URLLoader.data that im retrievingif i trace loadedScores.data, i get this&name1=matt&score1=323250&name2=1234567890123456.. . and so o've tried passing it to a URLVariables constructor, but it says the string doesnt contain the correct name/variable pairs or something, and loadedScores.data.name1 doesnt work.
View 8 Replies
Sep 8, 2008
I am working on a flash movie for a client and I have not used flash much before at all. I have the object/embed code here below with the following src path sos.swf?wID=5. I need that wID so when I load certain variables from a php page later on in the movie I can access that persons information (wID correspons to the primary table key).
HTML Code:
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="[URL]" WIDTH="383" HEIGHT="180" id="myMovieName">
<PARAM NAME=movie VALUE="sos.swf?wID=5">
<PARAM NAME=quality VALUE=high>
<PARAM NAME=bgcolor VALUE=#FFFFFF>
[Code] .....
I have tried several things and I am not sure just how to access the flash URL variables. To make sure I am putting the action script in the right place I have only one layer, and when I click on that, I enter the actionscript in the actionscript window for that layer. Is that the correct place to put it? I am pretty sure it is but I just want to double check. The variables.text at the bottom are my dynamic text boxes that are displaying information from the sos.php file. Nothing is showing up in my movie and I am unaware of good debugging techniques for actionscript. I have tried to trace(widgetID); but nothing shows up in my movie. I am not sure if that is because of the image I have on the screen or what.
By the way here is the part in my php script that sends the variables over. They do have data in them but nothing is being displayed in the dynamic text boxes.
PHP Code:
$vars = "&firstname=".$name."&years=".$totalYears."&months=".$totalMonths."&days=".$totalDays."&minutes=".$totalMinutes."&meals=".$var_meals."&meetings=".$var_meetings."&movies=".$var_movies;echo $vars;
View 6 Replies
Jan 7, 2004
Can I call a variable declared in a SWF, and call the same variable into another SWF, when i am loading it using XML.I am declaring a variable in the "Child movie", and am loading this "Child movie" into a "Parent movie" using XML. Can I retrieve the variable declared in the "Child movie" in the "Parent movie".
View 1 Replies
Nov 9, 2008
I'm trying to read date variables from an external text file. I'm using the LoadVars method and it is working fine for regular string variables. I'm running into trouble trying to convert some of those strings into date variables so I can compare the current date to the targetDateX variable from the text file. I'm working on a countdown timer for a list of different times/dates. It will display the time left until the first event, then after that event the time left until the second event. I'm running the code in a for loop and everything is working except being able to convert the string with format (yyyy,mm,dd,hh,mm) into a date variable- I've attached a sample of where I'm having trouble.
View 1 Replies
Jun 30, 2009
I 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]....
View 5 Replies
Jul 20, 2010
how can get multiple variables from javascript
View 2 Replies
Jun 30, 2010
how can i use javscript variables from flash as3
View 1 Replies
May 13, 2010
I 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]....
View 1 Replies
Jan 3, 2011
[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 Replies
Feb 1, 2011
is 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 Replies
Aug 15, 2011
Is 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.
View 1 Replies
Jan 13, 2005
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 Replies
Jul 2, 2010
I'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?
View 1 Replies
Aug 25, 2010
How can I pass variables to be used on the page the flash is embed?
View 1 Replies
Jun 3, 2011
I 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",
View 2 Replies
Jul 7, 2004
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.
View 1 Replies
Jan 21, 2007
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 Replies
Nov 11, 2009
i`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]...
View 1 Replies
Jul 7, 2004
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.
View 1 Replies
Nov 21, 2002
i have:
[Code]....
View 3 Replies
Aug 9, 2010
I have this in AS3
var myName:String = "David";
var result:Number = ExternalInterface.call("methodInJS", myName);
trace("Result from JS call is: "+result);
[code].....
View 1 Replies
Mar 22, 2011
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 ?
View 2 Replies