Loading Variables from ASP into Flash

I can find plenty of tutorials detailing how to load
variables from a defined asp page into Flash, but here's my
dilemma...
I have an asp page that is reading a URL with a unique
identifier in it (www.sampleURL.com?id=123456), and then turns the
id number from the URL into a variable. On the same page then, sits
my swf where I need to use LoadVars to pull in that ASP variable
via Actionscript. If I don't have a static asp page to pull the
variables in from and I want to pass the variable within the same
asp page the swf is located on, how do I do it? Many thanks in
advance...

"bonzomn65" <[email protected]> wrote in
message
news:ej0630$pjh$[email protected]..
>I can find plenty of tutorials detailing how to load
variables from a
>defined
> asp page into Flash, but here's my dilemma...
>
> I have an asp page that is reading a URL with a unique
identifier in it
> (www.sampleURL.com?id=123456), and then turns the id
number from the URL
> into a
> variable. On the same page then, sits my swf where I
need to use LoadVars
> to
> pull in that ASP variable via Actionscript. If I don't
have a static asp
> page
> to pull the variables in from and I want to pass the
variable within the
> same
> asp page the swf is located on, how do I do it? Many
thanks in advance...
>
You don't need LoadVars for this at all. You can just pass
the variable to
your Flash movie by specifying a query string when you are
calling the
movie.
If you are using the straight object, embed method then it
would look
something like this:
<param name="movie" value="movie.swf?id=11111">
<embed src="movie.swf?id=11111" ... >
If you are using the ActiveContent JavaScript for your movie
then you just
leave off the .swf... so
"name", "movie?id=11111"
Then, in flash you can access the value of id from the _root,
like
var idInFlash:Number = _root.id;
Of course in the above example you would replace 11111 with
the proper
syntax for printing a variable's value in ASP.

Similar Messages

  • Load variables from XML into Flash

    I was wondering how to load variables from an XML document to
    a Flash file? I am familiar with the code to do it for a text file,
    but was wondering how to do it for XML.
    Many thanks in advance!
    JJ

    Thanks for the recommendation on the site. What I am trying
    to do is load varaibles from an XML file into text boxes in my
    flash movie.
    Here is my loading:
    var my_xml = new XML();
    my_xml.ignoreWhite = true;
    my_xml.onLoad = function(success){
    if (success) {
    gotoAndStop("slide01");
    my_xml.load("narration.xml");
    this is what I have on my frame with the text boxes (the text
    boxes are also have the variable name in the variable area)
    var narration = my_xml.picture01;
    var my_title = my_xml.my_title;
    var my_date = my_xml.my_date;
    should I do my_date.text = my_xml.my_date; instead?
    my xml doc looks like this
    <?xml version="1.0" encoding="iso-8859-1"?>
    <picture01>This is the text for picture
    01</picture01>
    <picture02>This is the text for picture
    02</picture02>
    <my_title>Las Vegas</my_title>
    <my_date>October</my_date>
    Any help on this would be GREATLY appreciated!
    Text
    my_date.text = my_xml.my_date;

  • Send Variable From ASP to Flash to ASP

    I'm really, really new to Flash and using Flash 8 Pro. This
    is what I'm trying to do. I have a list of cars, when someone
    clicks on a car, they are taken to a page with details about the
    car and a flash gallery. The Flash Gallery is reads the image files
    names from an xml file. I'm really using an asp file (photos.asp).
    Anyway, I need the pass photos.asp the vin of the car from flash.
    I did this is the VehicleDetailSaleen.asp screen
    <object
    classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="
    http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"
    width="600" height="530">
    <param name="movie"
    value="photogallery.swf?VIN=<%=(Recordset1.Fields.Item("VIN").Value)%>">
    <param name="quality" value="high">
    <param name="VIN"
    value="<%=(Recordset1.Fields.Item("VIN").Value)%>">
    <embed
    src="photogallery.swf?VIN=<%=(Recordset1.Fields.Item("VIN").Value)%>"
    width="600" height="530" quality="high" pluginspage="
    http://www.macromedia.com/go/getflashplayer"
    type="application/x-shockwave-flash"
    vin="<%=(Recordset1.Fields.Item("VIN").Value)%>"></embed>
    I just don't know how to catch it in the flash file and send
    it back....
    #include "scripts.as"
    LoadVars;
    loadPhotoXML("Photos.asp?VIN="+ this.vin);
    mclThumbnails.onEnterFrame=function(){
    thumbnailsRoll()
    function loadPhotoXML(filename:String):Void {
    photoXML.ignoreWhite = true;
    photoXML.load(filename);
    photoXML.onLoad = function(success:Boolean):Void {
    if (success) {
    photoNumber = 0;
    rootNode = this.firstChild;
    totalPhotos = rootNode.childNodes.length;
    for (var i = 0; i<totalPhotos*2; i++) {
    if (i<totalPhotos) {
    thumbnails
    = rootNode.childNodes.childNodes[0].firstChild.nodeValue;
    url
    = rootNode.childNodes.childNodes[1].firstChild.nodeValue;
    titleText
    = rootNode.childNodes.childNodes[2].firstChild.nodeValue;
    } else {
    thumbnails
    =
    rootNode.childNodes[i-totalPhotos].childNodes[0].firstChild.nodeValue;
    url =
    rootNode.childNodes[i-totalPhotos].childNodes[1].firstChild.nodeValue;
    titleText
    =
    rootNode.childNodes[i-totalPhotos].childNodes[2].firstChild.nodeValue;
    thumbnailsLoad(i);
    checkProgressLoad(0);
    caption.text = titleText[0];
    Please, I know I don't know anything, but I've been reading
    forums for 2 days and everyone seems to have a different idea but I
    don't really understand them. I just need a simple, do this, then
    this sort of help.
    Thanks,
    Heather

    heatherlsi. anyway you can post your resulting code? having
    probelm with writing a Flash to ASP script... thanks

  • Passing variable from php into flash, help please

    Here are what I'm having:
    <?PHP
    $testVal = "This is a test";
    $test = urlencode($testVal);
    $out = "test=". $testVal;
    echo $out;
    ?>
    // and this is my flash file
    function getData() {
    // Prepare request
    var urlReq:URLRequest=new URLRequest("http://localhost/test.php");
    urlReq.method=URLRequestMethod.GET;
    var loader:URLLoader = new URLLoader();
    loader.dataFormat=URLLoaderDataFormat.VARIABLES;
    loader.addEventListener(Event.COMPLETE, completeHandler);
    loader.load(urlReq);
    function completeHandler(evt:Event) {
    var vars:URLVariables = URLVariables(evt.target.data);
    trace(" TEST = ", vars.test);
    trace(" TEST = ", unescape(vars.toString()));
    // and below is the ouput
    TEST = undefined
    TEST = test=This is a test
    I've tried with several different ways to get ONLY the value of the variable - that means I only want to have "This is a test" returned, but I either got "undefined" or the whole thing "test=This is a test", instead.
    I'm new to Flash and PHP. Please help.
    Thanks

    There's no need to write any fake variables out, Flash does not need that. OK, here's a simple PHP script like yours - I called it test.php
    <?PHP
         $testVal = "This is a test";
         $out = "test=". $testVal;
         echo $out;
    ?>
    And the AS to call it:
    var myLoader:URLLoader = new URLLoader();
    myLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
    myLoader.load(new URLRequest("http://www.mydomain.com/test.php"));
    myLoader.addEventListener(Event.COMPLETE, dataLoaded, false, 0, true);
    function dataLoaded(e:Event){  
        trace( e.target.data.test);
    You will see 'This is a test' traced to the output window.
    HTH

  • Movie refuses to load variables from text file

    Hi,
    I'm sure you can solve my newbie problem in less than 1
    minute...
    I'm pulling my hair out on a template I bought 2 days ago
    from templatemonster.com
    I am using Flash 8 Pro.
    All I want to do is change an existing textfield that is
    Static to Dynamic and load variables from a text file.
    The Action Script I use to do so comes directly from
    Macromedia documentation (see attached)
    It works fine when I create a brand new movie, but doesn't do
    anything when inserted into the template.
    It doesn't even complain about not finding the text file if I
    rename or delete it!
    Here are the FLA and text file:
    Edit : Link to source file removed
    The textfield I would like to change is in the txt2 symbol.
    Here is how I proceed:
    When I open HEADER.FLA, Flash tells me I'm missing a font,
    ok, so I click on Use Default, I'll deal with this later.
    I open up the Movie Explorer, go to Layer 30, go to Frame 75
    and click once on txt2
    I name the instance "myMovie_mc" and save (converts from
    Flash MX to Flash 8)
    I double-click on the Movie Clip, select the word
    "Automobile" on the Stage, change from Static to Dynamic and call
    that instance "myText_txt"
    Still in the Movie Clip, I create a new layer I call
    "actions", and in Frame 1 I copy the attached Action Script:
    This script works when I create a new flash file, but it does
    absolutely nothing in this template.
    I know I'm doing something wrong, but I wonder what?
    Many thanks to any helping soul!
    Ferris.

    try this:
    // Load text as variable and assign it to the
    // dynamic text field
    var features_lv:LoadVars = new LoadVars();
    features_lv.onLoad = onText();
    features_lv.load("safetyFeatures.txt");
    function onText(success:Boolean) {
    if (success) {
    myText_txt.text = features_lv.safetyfeatures;
    } else {
    myText_txt.text = "unable to load text file.";
    or this
    // Load text as variable and assign it to the
    // dynamic text field
    var features_lv:LoadVars = new LoadVars();
    features_lv.onLoad = function(success) {
    if (success) {
    myText_txt.text = features_lv.safetyfeatures;
    } else {
    myText_txt.text = "unable to load text file.";
    features_lv.load("safetyFeatures.txt");

  • How to load variables from a .txt file

    Hi.
    I usually make a flash aplication in colaboration with a php
    programmer. But i want to test my swfs without having to wait for
    him. So i want to do that through a text file. I know that flash
    can load variables from text files. The problem is i don't know how
    to format the text file ( example.txt).
    Thank you

    Here's a couple of ideas.
    First you probably want to change what you have...and put
    your 'if (pVar==1' etc inside a separate function and call it from
    the onLoad handler after you have assigned the value to pVar...
    because the onLoad will run at some unknown point in time after
    loading has finished (actually in the test environment this might
    work... but that wouldn't be the same as what happens in a
    production setting).
    To create test files for loadvars... simply create a new as2
    file and put this code on the first frame and test movie:

  • How to speed up the loading of live data into flash file.

    How to speed up the loading of live data into flash file if the swf file size is 1.5 MB. Flash file is using 20 web service connections to load the live data.

    Hello,
    I am also facing a similar problem wherein the SWF file takes time to load the refreshed data in Infoview i.e. after exporting the xlf file to Business Objects platform. Currently I am using Xcelcius Engage/Enterprise 2008 SP3 Windows (file name: 51038212.ZIP) version 5.3.0.0 build number 12,3,0,670. Also the SWF file is approximately 2MB in size  and it uses 42 live office connections.
    Please suggest solution as to how to decrease the time it takes to refresh the live office connections.

  • How to load data from Quikbooks into PeopleSoft General Ledger module ?

    Folks,
    Hello.
    My client's data is currently stored in Quikbooks.
    After install PeopleSoft FSCM 9.0, I need to load the data from Quickbooks into PeopleSoft General Ledger module. But I don't know how to use PeopleSoft Integration Broker to integrate with Quikbooks.
    Can any folks tell me how to load data from Quikbooks into PeopleSoft General Ledger module ?

    Hi,
    If the data load is one time process, then you can use PL/SQL or datamover to load the data to PeopleSoft application.
    If you want to load the data in real time, then you need to create In-bound and out-bound nodes to perform the transaction.
    Thanks
    Soundappan

  • Going from Illustrator into Flash

    I tried asking in the Flash forum, though I received no response.
    When copying-and-pasting symbols from Illustrator into Flash CS5:
    1. Does it make a difference if you paste on the main stage in Flash or create
    a new symbol first and paste it there?
    2. After pasting on the stage two separate symbols, I get two separate
    folders called FlashAICB with a subfolder called Illustrator Symbols
    containing my copied symbol. Can I move the two symbols together into
    the same folder? Can I change the name of the FlashAICB folder?
    Will this cause any problems?
    Thanks!

    1)If you copy/paste an object from illustrator to flash as is, it will be an object in flash and certain operations require the object to be a symbol which can be done by hitting F8. This is the same thing as creating a symbol in illustrator first.
    2)Right clicking on the symbols will let you move the symbols to the root or another folder or even a new folder. Think of the folders as organizers.

  • Loading Variables from a php file

    Im trying to get the stats from a shoutcast radio stations
    into flash so i can manipulate them into a nicer looking site.
    Anyway, ive identified the line on which the stats are
    updated (its in a php file, line 48):
    <stong>Current
    Song:</strong></b><p><marquee>
    Morel&#x27;s Grooving Again - That Melody [Morel&#x27;s
    Groove Mix]</font></p>
    and i was wondering the following things:
    is it possible to have flash load only this line of text from
    the php file,
    how do i get flash to recognise "<stong>Curren Song" as
    the variable
    how to get flash to recognise the colon sign as meaning that
    that is waht the variable is equal to,
    and how, once flash recognises the parameter, to remove the
    formatting code from the text.
    Or is there an easier way of getting this variable into
    flash, like using some kind of self-updating html file...
    help would be much appreciated.
    thanks

    u can convert the array in to a string in FLEX and in PHP u can use the "split" command...
    here s sample program see if it helps u
    http://flexarraytransfer.blogspot.com/
    similary u can transfer VARIABLES also,in the place of the string just put ur variable on the PHP use t variable without spliting t

  • Im stumped with loading an id number into flash.

    I have a flash file (actionscript 2) created that calls an
    external text file, and loads it into a scrolling text area.
    example: // send and load variables
    lv.load("
    http://website.com/" + id + ".txt");
    the url i want to load looks like this:
    http://www.website.com/1.txt
    the "1" is the id number. i have multiple id numbers.
    example: "2", "3", "4" , etc.
    if i direct link it like: lv.load("
    http://website.com/1.txt"); it
    works perfect.
    however, since i have multiple files, i want to determine the
    url by the "embed code"
    so i have something like
    <param name="movie" value="events.swf?id=12" /> and
    <embed src="events.swf?id=1" .....
    for some reason its not work. I thought I had it right, but
    apparently not.
    I have been wasting hours on this. Someone please
    help.

    try the following:
    - _root.id instead of just id
    - pass the id through with <param name="FlashVars"
    value="id=1"> (in addition to what you have already... different
    browsers work differently in this case...)
    - set a default id in case the id doesn't come through
    http://www.permadi.com/tutorial/flashVars/index.html
    Hope that helps.
    stephank

  • Best way to pass vars from html into flash?

    I've read a variety of pages that describe how to pass a variable into a flash movie (AS3, player = v9) from the html in which it is embedded.  This page describes AS3 but neglects to mention what to do with the object and embed tags in the noscript section. Furthermore, I'm not sure the javascript I see generated in my page looks like the example there (the js in my page doesn't check AC_FL_RunContenta against zero).  This page is quite long and appears to deal mostly with AS1 and AS2 approaches which I have used before and neglects entirely the newish javascript approach which appears to be used to embed flash these days (i.e., the javascript function AC_FL_RunContent).
    I was wondering if someone could spell out the proper way to pass in a variable from HTML so that flash can see it in such a way that works even if javascript is disabled, in all browsers, etc., etc.
    I've attached the HTML generated by the Flash IDE to this topic.  Any help would be much appreciated.

    You'll have to search for that concise and thorough list of steps or figure it out using the information you now have, which is sufficient to get it done.  It's not that hard--add the FlashVars in the embedding code in the three places and use the various examples you have links to to add the code in the Flash file to access and use the FlashVars.
    Your Flash will be embedded in a web page depending on the visitors settings... if they allow javascript then the javascript portion will be used.  If they don't, then either the object or embed sections will be used depending on their browser.
    As far as javascript changes go, don't sweat 'em until you have a problem... use whatever code your Flash-created html page creates to embed the file in the page.

  • Passing variables from PHP to Flash

    I have a contact form that works. The user enters their info,
    hits submit, and their info is emailed to me. I need to figure out
    how to have the PHP script send back a confirmation that the email
    was actually sent. I can't get the php to echo just a "yes" or
    "no". Here is what I have so far:
    Flash code to bring in PHP variable to notify user if mail
    has been sent or not:
    function receive_response(e:Event):void
    var loader:URLLoader = URLLoader(e.target);
    var email_status = new URLVariables(loader.data).success;
    if(email_status == "yes")
    status_txt.text = "Success! Your message was sent.";
    timer = new Timer(500);
    timer.addEventListener(TimerEvent.TIMER, on_timer);
    timer.start();
    else
    status_txt.text = "Send failed! Please email or call us";
    and here is my entire PHP Code. The code in bold at the bottom
    is where it is supposed to pass the "yes" or "no" as the variable
    success
    <<meta http-equiv="content-type"
    content="text/html;charset=utf-8">
    <?php
    // Create local PHP variables from the info the user gave in
    the Flash form
    $senderName = $_POST['userName'];
    $senderEmail = $_POST['userEmail'];
    $senderMessage = $_POST['userMsg'];
    // Strip slashes on the Local variables
    $senderName = stripslashes($senderName);
    $senderEmail = stripslashes($senderEmail);
    $senderMessage = stripslashes($senderMessage);
    $to = "info@*******.com";
    // change this to reflect your site
    $from = "contact@*********.com";
    $subject = "Contact from ***********.com";
    //Begin HTML Email Message
    $message = <<<EOF
    <html>
    <body bgcolor="#FFFFFF">
    <b>Name</b> = $senderName<br /><br />
    <b>Email</b> = <a
    href="mailto:$senderEmail">$senderEmail</a><br
    /><br />
    <b>Message</b> = $senderMessage<br />
    </body>
    </html>
    EOF;
    //end of message
    $headers = "From: $from\r\n";
    $headers .= "Content-type: text/html\r\n";
    $to = "$to";
    if (mail($to, $subject, $message, $headers))
    echo “success=yes”;
    else
    echo “success=no”;
    exit();
    ?>
    Thanks

    I have a contact form that works. The user enters their info,
    hits submit, and their info is emailed to me. I need to figure out
    how to have the PHP script send back a confirmation that the email
    was actually sent. I can't get the php to echo just a "yes" or
    "no". Here is what I have so far:
    Flash code to bring in PHP variable to notify user if mail
    has been sent or not:
    function receive_response(e:Event):void
    var loader:URLLoader = URLLoader(e.target);
    var email_status = new URLVariables(loader.data).success;
    if(email_status == "yes")
    status_txt.text = "Success! Your message was sent.";
    timer = new Timer(500);
    timer.addEventListener(TimerEvent.TIMER, on_timer);
    timer.start();
    else
    status_txt.text = "Send failed! Please email or call us";
    and here is my entire PHP Code. The code in bold at the bottom
    is where it is supposed to pass the "yes" or "no" as the variable
    success
    <<meta http-equiv="content-type"
    content="text/html;charset=utf-8">
    <?php
    // Create local PHP variables from the info the user gave in
    the Flash form
    $senderName = $_POST['userName'];
    $senderEmail = $_POST['userEmail'];
    $senderMessage = $_POST['userMsg'];
    // Strip slashes on the Local variables
    $senderName = stripslashes($senderName);
    $senderEmail = stripslashes($senderEmail);
    $senderMessage = stripslashes($senderMessage);
    $to = "info@*******.com";
    // change this to reflect your site
    $from = "contact@*********.com";
    $subject = "Contact from ***********.com";
    //Begin HTML Email Message
    $message = <<<EOF
    <html>
    <body bgcolor="#FFFFFF">
    <b>Name</b> = $senderName<br /><br />
    <b>Email</b> = <a
    href="mailto:$senderEmail">$senderEmail</a><br
    /><br />
    <b>Message</b> = $senderMessage<br />
    </body>
    </html>
    EOF;
    //end of message
    $headers = "From: $from\r\n";
    $headers .= "Content-type: text/html\r\n";
    $to = "$to";
    if (mail($to, $subject, $message, $headers))
    echo “success=yes”;
    else
    echo “success=no”;
    exit();
    ?>
    Thanks

  • Passing variables from php to flash and the opposite

    Hi guys, im trying weeks now to solve this problem but nothing yet
    If someone could just tell me how to pass variables from flash to php and the opposite i would be thankful!!! Please help!

    I have recently had to learn this, so this may not be the best way but it worked for me
    I suggest looking at the code below stripping out everything you don't need (e.g. the databse stuff) and just get a simple string going back and forward
    have a go and post any problems here and I'll try and help
    in flash i have
    private function getBalanceAndXP():void
              var request:URLRequest = new URLRequest("utils.php");
              request.method = URLRequestMethod.POST;
              var variables:URLVariables = new URLVariables();
              variables.func = "getBalance";
              variables.fbid = userID;
              request.data = variables;
              var loader:URLLoader = new URLLoader();
              loader.dataFormat = URLLoaderDataFormat.VARIABLES;
              loader.addEventListener(Event.COMPLETE, onBalanceComplete);
              loader.load(request);
    private function onBalanceComplete(e:Event):void
              var loader:URLLoader = e.target as URLLoader;
              loader.removeEventListener(Event.COMPLETE, onBalanceComplete);
              var variables:URLVariables = new URLVariables(loader.data);
              _balance = parseInt(variables.balance); // class variable
              _experience = parseInt(variables.experience); // class variable
    public function setBalanceAndXP(balance:int, experience:int):void
                _balance = balance;
              _experience = experience;
              var request:URLRequest = new URLRequest("utils.php");
              request.method = URLRequestMethod.POST;
              var variables:URLVariables = new URLVariables();
              variables.func = "setBalance";
              variables.fbid = userID;
              variables.balance = _balance;
              variables.experience = _experience;
              request.data = variables;
              var loader:URLLoader = new URLLoader();
              loader.dataFormat = URLLoaderDataFormat.VARIABLES;
              loader.load(request);
    and then I have my php file
    <?php
    $func = $_POST["func"];
    $fbid = $_POST["fbid"];
    $balance = $_POST["balance"];
    $experience = $_POST["experience"];
    $numVariables = 0;
    $link = mysql_connect("localhost","username","password");
    mysql_select_db("databaseName");
    if ($func == "getBalance")
              getBalance($fbid);
    else if ($func == "setBalance")
              setBalance($fbid, $balance, $experience);
    mysql_close($link);
    function getBalance($fbid)
              $query = "SELECT balance, experience FROM tableName WHERE fbid = '".$fbid."'";
              $result = mysql_query($query);
              $row = mysql_fetch_row($result);
              writeVariable("balance", $row[0]);
              writeVariable("experience", $row[1]);
    function setBalance($fbid, $balance, $experience)
              $query = "UPDATE tableName SET balance = ".$balance.", experience = ".$experience." WHERE fbid ='".$fbid."'";
              mysql_query($query);
    function writeVariable( $name, $value )
              global $numVariables;
              if ( $numVariables > 0 )
                        echo "&";
              echo $name . "=" . urlencode($value);
              $numVariables++;
    ?>

  • Loading variables from txt

    Hello everybody,
    I have a flash file with two dynamic fields which get data
    from a txt file. There is one more dynamic field in flash which i
    want to display a certain calculation result between the values of
    the two other dynamic fields. The two vars are loaded from the txt
    file without any problem, but flash recognizes them as strings and
    as a result, the calculation is impossible (NaN). How can i convert
    the loaded data from the txt file into numeric ones in order to be
    able to do calculations between them?
    Thank you

    You have a choice:
    if your string values is called myVar1
    You can convert it to a number type in the following ways:
    myVar1=parseInt(myVar1); //for parsing integer values,
    ignores after any decimal points - useful particularly for hex
    strings etc
    myVar1=parseFloat(myVar1); //parses the value into a regular
    precision number
    myVar1=Number(myVar1);
    You can read more about each of the above in the relevant
    links on the following page:
    http://livedocs.adobe.com/flash/9.0/main/00001166.html

Maybe you are looking for