Flash, AS3, PHP, & Query Strings

I think what I am after is pretty simple but unfortunately, I
don't know much php. Basically what I am looking for is this.
I want to pass a query from the browser address to a flash
document.
For Example, if someone visits.
http://www.whatever.com/tour?mls=123456789
(or tour.php?mls=123456789, whatever is easiest)
A document opens, resizes the browser (optional but would be
nice), and loads a flash SWF. It also passes the mls=123456789
string into flash to a variable mls.
Any ideas?
Thanks!
Drew

Try: URLLoaderDataFormat.VARIABLES

Similar Messages

  • Pass Variables into AS3 through Query String?

    Man! I've been searching ferociously and can't seem to find a solution that works for me. I am trying to pass variables via query string on a PHP page to Flash, and then have the swf add movie clips to the stage depending on the information it receives.
    Here is what the PHP outputs:
    swfobject.embedSWF("flash/detailScore.swf?a=0-0&b=0-0&c=30-54&d=30-20&e=42-18", ...
    And here is my AS3 code:
    function loaderInfoSh(e:Event):void{
    var myQueryStrings=this.loaderInfo.parameters;
    a = myQueryStrings.a;
    b = myQueryStrings.b;
      c = myQueryStrings.c;
    d = myQueryStrings.d;
    e = myQueryStrings.e;
    addTheResults(a,1);
    addTheResults(b,2);
    addTheResults(c,3);
    addTheResults(d,4);
    addTheResults(e,5);
    this.loaderInfo.addEventListener(Event.COMPLETE, loaderInfoSh);
    The addTheResults function takes the coordinates, adds a MC instance to the stage and positions it accordingly.
    var colorMCArray:Array = new Array();
    function addTheResults(val,colnum:Number){
    if(val == null){val = "52-46";} // so I can test it locally
    var daColor:String;
    switch (colnum){
    case 1:
    daColor = "f3951c";
    break;
    case 2:
    daColor = "74b47d";
    break;
    case 3:
    daColor = "436494";
    break;
    case 4:
    daColor = "9b74ac";
    break;
    case 5:
    daColor = "b43d44";
    break;
    var dash:int = val.indexOf("-");
    var lateral = val.slice(0,dash);
    var vertical = val.slice(dash+1);
    lateral --;
    vertical --;
    // adding the MC instance
    var comm:tileB = new tileB();
    comm.name = "comm"+colnum;
    addChild(comm);
    colorMCArray[colnum] = comm;
    //Change the color
    var colorTransform:ColorTransform = colorMCArray[colnum].transform.colorTransform;
    var thiscolor = "0x"+daColor;
    colorTransform.color = thiscolor;
    colorMCArray[colnum].transform.colorTransform = colorTransform;
    colorMCArray[colnum].x = 5;
    colorMCArray[colnum].y = 536;
    colorMCArray[colnum].x += (lateral * 9);
    colorMCArray[colnum].y += (vertical * 9)*-1;
    colorMCArray[colnum].addEventListener(MouseEvent.MOUSE_OVER, btnro);
    colorMCArray[colnum].addEventListener(MouseEvent.MOUSE_OUT, btnrout);
    I don't know what I'm doing wrong here.

    Was this the "e" in the code below you were pertaining to as the culprit? "e" is not a keyword. It's just the shortcut for the word "event" for the variable name of type Event which is the Event object that triggered the call of function loaderInfoSh. In your code you assigned e = myQueryString.e which should have given you a type mismatch error.
    function loaderInfoSh(e:Event):void{
    var myQueryStrings=this.loaderInfo.parameters;
    a = myQueryStrings.a;
    b = myQueryStrings.b;
      c = myQueryStrings.c;
    d = myQueryStrings.d;
    e = myQueryStrings.e;
    addTheResults(a,1);
    addTheResults(b,2);
    addTheResults(c,3);
    addTheResults(d,4);
    addTheResults(e,5);
    this.loaderInfo.addEventListener(Event.COMPLETE, loaderInfoSh);

  • Passing Flash Vars Through Query Strings and JS

    I'm trying to get a particular video to play in a flash ad
    when a particular query string is clicked. I can't get it to work
    and would appreciate any help that you can provide. The ad plays
    but the movies don't show when the query string is clicked or when
    you click on objects in the movie that are supposed to populate a
    movie. Here's the code I've been trying to use:

    Thanks for the advice, I have tried Javascript to resolve the
    problem. In response to the <object> tag missing, There is
    one I just included a snippet of the html code sorry for the
    confusion. Due to deadlines I abandoned the functionality of the
    script and "dumbed" down the script. Thank you again for the help

  • Creating a file on server, using Flash AS3 + PHP

    I have a very simple PHP script that creates a new file on my server using a random number for the file name (e.g., 412561.txt).  When I load the script directly from a browser, it works.  But when I load the script from a very simple Flash (AS3) script, it does not work (i.e., doesn't create a file).  The Flash script and PHP script are both in the same directory.  Permissions on the directory and its content are 755.  Temporarily setting those permissions to 777 does not solve the problem (i.e., PHP still doesn't create file when called via Flash).
    Here is my phpinfo.
    Here is the PHP file.
    The contents of the PHP file are:
    <?php
    error_reporting(E_ALL);
    ini_set("display_errors", 1);
    $RandomNumber = rand(1,1000000);
    $filename = "$RandomNumber" . ".txt";
    $filecontent = "This is the content of the file.";
    if(file_exists($filename))
              {$myTextFileHandler = fopen($filename,"r+"); }
    else
              {$myTextFileHandler = fopen($filename,"w"); }
    if($myTextFileHandler)
              {$writeInTxtFile = @fwrite($myTextFileHandler,"$filecontent");}     
    fclose($myTextFileHandler);   
    ?>
    Here is the html container for the Flash script.  The Flash script features a single button which calls the PHP script when pressed.  In case it helps, here is the raw Flash file itself.  The code of the Flash script is as follows:
    stop();
    var varLoader:URLLoader = new URLLoader;
    var varURL:URLRequest = new URLRequest("http://www.jasonfinley.com/research/testing/TestingSaveData.php");
    btnSave.addEventListener(MouseEvent.CLICK,fxnSave);
    function fxnSave(event:MouseEvent):void{
              btnSave.enabled=false;
              varLoader.load(varURL);
    Directory listing is enabled at the parent directory here, so you can see there when a new text file is created or not.  (Um, if this is a security disaster, please let me know!)
    Can anyone please help me understand why this isn't working and how I can fix it?  Thank you
    ~jason

    #1, Yes that is a security risk, please disable directory index viewing.
    #2, Always validate. I see no issue with the code you're using but clearly it's not working. The way you find out is your trusty errors.
    Make a new document (or paste this into your existing) where a button with the instance name btnSave is on screen:
    // import required libs
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.events.Event;
    import flash.events.IOErrorEvent;
    import flash.events.MouseEvent;
    import flash.events.SecurityErrorEvent;
    import flash.text.TextField;
    // assign handler
    btnSave.addEventListener(MouseEvent.CLICK, fxnSave);
    // make a textfield to display status
    var tf:TextField = new TextField();
    addChild(tf);
    tf.width = stage.stageWidth;
    tf.height = 300;
    tf.multiline = true;
    tf.wordWrap = true;
    tf.selectable = false;
    tf.text = "Loading...\n";
    // just making sure the textfield is below the button
    this.swapChildren(tf,btnSave);
    function fxnSave(event:MouseEvent):void
        // disable button
        event.currentTarget.enabled = false;
        // new loader
        var varLoader:URLLoader = new URLLoader();
        // listen for load success
        varLoader.addEventListener(Event.COMPLETE, _onCompleteHandler);
        // listen for general errors
        varLoader.addEventListener(IOErrorEvent.IO_ERROR, _onErrorHandler);
        // listen for security / cross-domain errors
        varLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, _onErrorHandler);
        // perform load
        varLoader.load(new URLRequest("http://www.jasonfinley.com/research/testing/TestingSaveData.php"));
    // complete handler
    function _onCompleteHandler(e:Event):void
        tf.appendText("Load complete: " + e);
    // error handler
    function _onErrorHandler(e:Event)
        if (e.type == SecurityErrorEvent.SECURITY_ERROR)
            tf.appendText("Load failed, Security error: " + e + " type[" + e.type + "]");
        else if (e.type == IOErrorEvent.IO_ERROR)
            tf.appendText("Load failed, IO error: " + e + " type[" + e.type + "]");
    I get a Event.COMPLETE for mine, so the PHP script is definitely firing. Change the URL to something invalid and you'll see the IOErrorEvent fire off right away.
    That leaves you to diagnose the PHP script. Check your error_log and see what is going wrong. You're suppressing errors on your file write which doesn't help you locate the issue saving the file. If you want to handle errors yourself you should do the usual try/catch and handle the error yourself (write a debug log file, anything).

  • Php & query string variables in a url

    I've been scratching my head for a couple days now. What I'm
    trying to do seems soooooo easy but it doesn't work. Maybe someone
    can spot my problem in the code.
    What I'm doing is breaking a single blob mysql field into
    multiple "pages" by inserting a code snippet into the field. That
    part works fine. The url for the page in question with a sample
    article is
    http://208.106.143.80/articles/articles.php?idq=141&cat=4&pg=1
    The url contains the article id, article category and page
    number. At the bottom of the page is the pagination that reloads
    the page with another "page" of the article. The code for that is:
    $totalpages = $total;
    if ($totalpages > 1) {
    echo "<p
    style='text-align:right;'><strong>Page:</strong> ";
    if ($i > 1) {
    echo " <a
    href='".$_SERVER['PHP_SELF']."?pg=".($i-1)."'><<
    Prev</a> ";
    for ($x = 1; $x <= $totalpages; $x++) {
    if ($x == $i) {
    echo "<strong>[".$x."]</strong> ";
    else {
    echo "<strong><a
    href='".$_SERVER['PHP_SELF']."?pg=".$x."'>".$x."</a></strong>
    if ($i < $total) {
    echo " <a
    href='".$_SERVER['PHP_SELF']."?pg=".$k."'>Next
    >></a></p>";
    Basically all I'm doing is throwing the new querystring pg=$x
    to the end of the current page url and reloading the current page.
    And that is the problem. Even though the page links look right in
    the browser, it just keeps loading the same "page" over and over
    again. I can go into the url in the browser and manually change
    from page 1 to page 2, etc. and that works as it should.
    Ideas from anyone smarter than I?
    What am I missing here.

    .oO(aerobicdesign)
    >Hi Peter. No, that I can add if need be. But if you go to
    the link I provided
    >to you below, then go down to the bottom of the page and
    click on any of the
    >page numbers, eventhough the link appears to be correct
    (as in the pg=x
    >changes), the page, when it reloads, is still the same
    page.
    The response from the server is somewhat broken. In some
    browsers this
    might lead to a reload of the current page, in others like
    Opera and
    Lynx you'll get a "Object Moved" response instead, containing
    a link to
    the same page.
    This is your posted link:
    http://208.106.143.80/articles/articles.php?idq=141&cat=4&pg=1
    These are the links at the bottom of that article:
    http://208.106.143.80/articles/articles.php?pg=2
    http://208.106.143.80/articles/articles.php?pg=3
    But of course this won't work.
    > It is like something is just eating up the querystring
    I'm sending to that
    >page.
    No, you're just not creating a complete query string. The
    article and
    category IDs are missing, so the script doesn't know what to
    display.
    Micha

  • Contact forms in Flash (AS3/PHP)

    Hello,
    I have created a form in flash (CS5) using AS3 and Php.
    The test run worked absolutely fine but now I have added the form to my (original) flash movie it has a number of errors come up...
    Thing is that I've just spent the last 2 hours trying to get this form to work and having no success what so ever.
    So does anyone know what the following complier errors mean and how I can solve this issue?
    Scene 1
    1152: A conflict exists with inherited definition flash.display:DisplayObject.name in namespace public.
    ComponentShim (Compiled Clip), Line 1
    5000: The class 'fl.controls.TextArea' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type.
    ComponentShim (Compiled Clip), Line 1
    5000: The class 'fl.controls.TextInput' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type.
    ComponentShim (Compiled Clip), Line 1
    5000: The class 'fl.controls.UIScrollBar' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type.
    ComponentShim (Compiled Clip), Line 1
    5000: The class 'fl.controls.Button' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type.
    Yes, I'm obviously a newbie and still getting to grips with flash so any help would be amazing!
    Thank you in advance,
    Jos

    add those components to the library of your main (ie, loading) fla.

  • Need a query string to a specific point and zoom in a public GIS Flash document

    I am working with a client's website, and have no developer access to the Flash document, only public access.
    I have been given the url for a county map that is presented in an interactive Flash document.
    http://68.156.95.45/newberrygis//#1
    Client would like me to focus in on their specific development, which requires panning the map and zooming in.
    How can I find a query string that will help me to do that?

    The functionality of the GIS map was important. I was given the email for the person in charge of the map, who helped me out. It appeared that he was able to outline the road in the neighborhood that I needed to focus on. That provided a parcel ID, which in turn made it possible to focus in on the proper area. This is supposition on my part; perhaps he has other info that gave him the parcel ID.
    I'm not a huge fan of Flash on other than desktops and laptops, but it is what it is, client needs to use it, I need to help the client out!
    B

  • How to get this PHP list in Flash AS3?

    Hi,
    I have the following PHP code (downloaded from net) which builds a list of all the files in a "MyPics" folders:
    PS php can build a list of all the files in a folder so you don't have to type them all out like that, plus it makes updating a sinch all you have to do is put a pic in the folder and it will be added to the list.
    PHP Code:
    <CODE>
    <?
    //this function goes through the defined directory and makes a list of all the files
    function parse_dir($dir,$level){
        $dp=opendir($dir); //opens the directory for reading
        while (false!=($file=readdir($dp))){  //runs until no more files
            if ($file!="." && $file!=".." && $file!=".htaccess"){  //so you don't get all the default folders
                $countervar=$countervar+1;  //just a counter for numbering the path names
                if (is_dir($dir."/".$file)) parse_dir  //recurses the subdirectories
    ($dir."/".$file,$level+1);
                else print "&path".$countervar."=".$dir."/".$file;  //pieces together something flash can read
    $start_dir="pathToMyPics";  //put the name of the folder with all the pics here
    $level=1;
    parse_dir($start_dir,$level);
    ?>
    <CODE/>
    The above php will output something like this
    &path1=pathToMyPics/pic1.jpg&path2=pathToMyPics/wowWhatAWierdPicName.jpg
    call the php in flash( loadVariables("fileListPHP.php") ) and viola you get easy to use paths to all you pictures.
    I am not able to understand the code to write on FLASH AS3 frame. Please help.
    Thanks.

    In AS3 you want to use the URLVariables class.  Search Google using "AS3 URLVariables tutorial" and you should find what you need to get going.  Here's one result from that search...
    http://www.metah.ch/blog/2008/01/using-urlvariables/

  • Flash query string and html

    Hi,
    The problem page is located at
    http://gauravchandra.info/gpi/mediaCentre.html
    I am using flash query string to pass a value into a variable
    so that the flash file loads at a particular frame.
    If you see the object and embed element, I have written
    "Body_image.swf?section=flame" in the movie source. This makes my
    flash movie play from a frame labeled - flame. But it is working
    only in internet explorer and that too only on local machine. When
    I upload it on server, it starts from the first frame everytime. In
    internet explorer, it works only on local and it does not even work
    on local in firefox.
    What am I doing wrong? Please help as it is urgent.
    Gaurav

    Would this be better suited for the Flash forum?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "gaurav_ch" <[email protected]> wrote in
    message
    news:gec4aq$gr9$[email protected]..
    > The flash file is kept at
    http://gauravchandra.info/gpi/Body_image.fla
    >
    > Please help.
    >
    > Gaurav

  • Query string with flash lite, possible?

    I searched the net and Adobe website, read the complete i-mode document provided by Docomo (on adobe site) and couldn't find any information on the subject. I'm trying to figure out if this is something specific to the Japanese market or all flash lite players react the same way. I will explain my issue.
    In flash, you can pass variables as a query string like this:
    http://www.mysite.com/myFlashFile.swf?val=1&val2=2 (etc)
    Those variables will end up on the root time line. After doing some testing, I cannot receive any of those variables if the version of flash lite is lower than 3.0. It happens for Docomo, AU, Softbank carrier, all japanese ones I tested. If I test with the Docomo emulator, I can reproduce this behavior.
    Does this behavior is by design?  Nobody seems to be talking about it.
    Thank you for any information on the subject.

    Hi Collin, Did you find the solution? I am facing similar problem where I do not want to send any xml/payload. Invoke PI interface with URL only. Please help.

  • Error: Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string co

    Error: Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs. at Error$/throwError() at flash.net::URLVariables/decode() at flash.net::URLVariables() at flash.net::URLLoader/onComplete() _________________________________________________________________________________________ _____________________ stop(); var DepartVars:URLVariables = new URLVariables(); var DepartURL:URLRequest = new URLRequest("scripts/www.mywebsite.com/depart.php"); DepartURL.method = URLRequestMethod.POST; DepartURL.data = DepartVars; var DepartLoader:URLLoader = new URLLoader; DepartLoader.dataFormat = URLLoaderDataFormat.VARIABLES; DepartLoader.addEventListener(Event.COMPLETE, completeDepart); depart_btn.addEventListener(MouseEvent.CLICK, DepartUser); // Function to run when the Depart button is pressed function DepartUser (event:MouseEvent):void{             // Ready the variables here for sending to PHP           DepartVars.post_code = "Depart";         // Send the data to the php file           DepartLoader.load(DepartURL);         welcome_txt.text = "Processing request...Bon Voyage"; } // Close DepartUser function /////////////////////////////////////// // Function for when the PHP file talks back to flash function completedepart(event:Event):void{     if (event.target.data.replyMsg == "success") {             var refreshPage:URLRequest = new URLRequest("javascript:NewWindow=window.location.reload(); NewWindow.focus(); void(0);");             navigateToURL(refreshPage, "_self");         } // Close completeDepart function ////////////////////////////// // Code for the View res Button var viewRes:URLRequest = new URLRequest("view_res.php"); viewRES_btn.addEventListener(MouseEvent.CLICK, viewResClick); function viewResClick(event:MouseEvent):void {     navigateToURL(viewRes, "_self"); } ///////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////// // Code for the Edit Res profile Button var editRes:URLRequest = new URLRequest("edit_res.php"); editRES_btn.addEventListener(MouseEvent.CLICK, editResClick); function editResClick(event:MouseEvent):void {     navigateToURL(editRes, "_self"); } }

    this should be in the as3 forum.  but you need to return name/value pairs from your php file.

  • AS3 & PHP

    I am trying to retrieve name and value pairs from a php
    script with AS3. Flash keeps giving me the error.
    Error #2101: The String passed to URLVariables.decode() must
    be a URL-encoded query string containing name/value pairs.
    Here is an extract of my php.
    while ($row = mysql_fetch_assoc ($qr)) {
    while (list ($key, $val) = each ($row)) {
    $r_string .= '&' . $key . $i . '=' .$val;
    $i++;
    // add extra & to prevent returning extra chars at the
    end
    $r_string .='&';
    echo $r_string;
    If i change the echo to something like echo "name&value"
    it works, its as if it does not like the $r_string. I have tried
    using urlencode($r_string) and string($r_string) but it fails. The
    php used to work in AS2 with sendAndLoad fine.

    Thanks for your reply, however php does not seem to have a
    URLEncode function, it has a urlencode function which I tried, I
    pointed that out at the bottom of my original post.
    Like I said previously, if i echo "name&value" (which is
    not urlencoded) it works fine.

  • FLVPlayback source with query strings (parameters) doesn't load

    Flash version: CS4
    AS version: AS3
    I'm currently trying to use the FLVPlayback component and pass a source FLV that's living on a cloudfront webserver. The problem is that the cloudfront requires authentication in the form of query strings in the source FLV. For example:
    import fl.video.*;
    var mainMovie:FLVPlayback = new FLVPlayback();
    mainMovie.source = "http://www.somedomainname.com/firmware.flv?dummyquery=22";
    trace(addChild(mainMovie));
    As soon as I take away the "dummyquery", it works fine. When I add a query string, it breaks (nothing loads).
    Here is the error output I get:
    [object FLVPlayback]
    VideoError: 1005: Invalid xml: URL: "http://www.somedomainname.com/firmware.flv?dummyquery=22&FLVPlaybackVersion=2.1" No root node found; if url is for an flv it must have .flv extension and take no parameters
         at fl.video::SMILManager/http://www.adobe.com/2007/flash/flvplayback/internal::xmlLoadEventHandler()
         at flash.events::EventDispatcher/dispatchEventFunction()
         at flash.events::EventDispatcher/dispatchEvent()
         at flash.net::URLLoader/onComplete()
    It adds on "&FLVPlaybackVersion=2.1" to the end.
    I saw a different article that said I should add a dummy variable at the end like "&dummy=.flv" because I was told that Flash is basically looking for an .flv extension at the end and you can trick it, but it doesn't work because they add on additional code.
    Does anyone know how to work around this?

    Hey supervu,
    I know you already found a workaround to make this work, just figured I'd post an alternative to editing the FLVPlayback compoent. I also am retrieving an FLV file via a .Net ASHX file. To keep both worlds happy, I used a URLRewriter module to translate for me... this one translates what I am using for the FLVPlayback component source:
    http://domain.com/flv/22.flv  to be resolved as http://domain.com/API/resource.ashx?ID=22
    There is of course no flv folder in the root of my application...
    Here is my very simple URLRewriter class in vb.net:
    Imports Microsoft.VisualBasic
    Imports System
    Imports System.Web
    Public Class URLRewriter
        Implements IHttpModule
        Public Sub Init(ByVal inst As System.Web.HttpApplication) Implements System.Web.IHttpModule.Init
            AddHandler inst.BeginRequest, AddressOf Me.OnBeginRequest
        End Sub
        Public Sub OnBeginRequest(ByVal app As Object, ByVal e As EventArgs)
            Dim inst As HttpApplication = CType(app, HttpApplication)
            Dim req_path As String = inst.Context.Request.Path
            Dim trans_path As String = ""
            Dim search As String = "/flv/"
            Dim pos As Integer = req_path.IndexOf("/flv/")
            If pos > -1 Then
                Dim key as string = req_path.Substring(pos + search.Length, (req_path.LastIndexOf(".flv") - (pos + search.Length)))
                HttpContext.Current.Response.Redirect("~/API/resource.ashx?ID=" & key )
            End If
        End Sub
        Public Sub Dispose() Implements System.Web.IHttpModule.Dispose
        End Sub
    End Class
    and make sure you add this to your web.config.. this will cause URLRewriter to intercept all HTTP requests, and redirect as needed.
    <system.web>
         <httpModules>    
              <add name="URLRewriter" type="[Namespace].URLRewriter"/>
          </httpModules>
    </system.web>
    Hope this helps someone.

  • Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containin

    Error: Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs. at Error$/throwError() at flash.net::URLVariables/decode() at flash.net::URLVariables() at flash.net::URLLoader/onComplete() _________________________________________________________________________________________ ____________ stop(); var DepartVars:URLVariables = new URLVariables(); var DepartURL:URLRequest = new URLRequest("scripts/www.mywebsite.com/depart.php"); DepartURL.method = URLRequestMethod.POST; DepartURL.data = DepartVars; var DepartLoader:URLLoader = new URLLoader; DepartLoader.dataFormat = URLLoaderDataFormat.VARIABLES; DepartLoader.addEventListener(Event.COMPLETE, completeDepart); depart_btn.addEventListener(MouseEvent.CLICK, DepartUser); // Function to run when the Depart button is pressed function DepartUser (event:MouseEvent):void{             // Ready the variables here for sending to PHP           DepartVars.post_code = "Depart";         // Send the data to the php file           DepartLoader.load(DepartURL);         welcome_txt.text = "Processing request...Bon Voyage"; } // Close DepartUser function /////////////////////////////////////// // Function for when the PHP file talks back to flash function completedepart(event:Event):void{     if (event.target.data.replyMsg == "success") {             var refreshPage:URLRequest = new URLRequest("javascript:NewWindow=window.location.reload(); NewWindow.focus(); void(0);");             navigateToURL(refreshPage, "_self");         } // Close completeDepart function ////////////////////////////// // Code for the View res Button var viewRes:URLRequest = new URLRequest("view_res.php"); viewRES_btn.addEventListener(MouseEvent.CLICK, viewResClick); function viewResClick(event:MouseEvent):void {     navigateToURL(viewRes, "_self"); } ///////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////// // Code for the Edit Res profile Button var editRes:URLRequest = new URLRequest("edit_res.php"); editRES_btn.addEventListener(MouseEvent.CLICK, editResClick); function editResClick(event:MouseEvent):void {     navigateToURL(editRes, "_self"); } }

    I have a similar problem
    whey I use .txt my code works, but when I change to .dat external file, it get error 1067
    my code:
    import flash.display.Sprite;
    import flash.events.*;
    import flash.net.URLLoader;
    import flash.net.URLLoaderDataFormat;
    import flash.net.URLRequest;
    var loader: URLLoader = new URLLoader();
    loader.dataFormat = URLLoaderDataFormat.VARIABLES;
    loader.addEventListener(Event.COMPLETE, loading);
    loader.load(new URLRequest("rssnews.dat"));
    function loading(e: Event): void {
              news_1.text = trace(e.target.data.titulo);
              news_2.text = trace(e.target.data.texto);

  • How to access FlashVars or URL Query String

    I am a bit of a rookie with Flash/AS3 and I need help trying to access FlashVars or URL in Object/Embed tags. I've searched in the Internet and the forums but cannot get my head around how to implement this.  Here is my example.
    1) ACTION SCRIPT - I have created a simple flash banner with clickable button (sparkle) with a mouse down event.
    The action script (AS3) for the button is the following:
    sparkle.addEventListener(
        MouseEvent.MOUSE_DOWN,
        function(evt:MouseEvent):void {
            var url:String = "http://www.[site_url].com/as/img.cfm";
          var request:URLRequest = new URLRequest(url);
            var variables:URLVariables = new URLVariables();
            variables.gphc = "382";
            request.data = variables;
            request.method = URLRequestMethod.GET;
          navigateToURL(request);
         *** the core issue to resolve is how to make the line above (variables.gphc = "382";) to be set dynamically.  I would like for the variable to come from the FlashVars or the URL vars
    2) OBJECT/EMBED - my object/embed code with include FlashVars and URL Query String
    <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" ID="bannerAD" WIDTH="728"  HEIGHT="90">
         <PARAM NAME="movie" VALUE="http://www.[site_url].com/images/imgs/flash_ad.swf?gphc=382">
        <PARAM NAME="quality" VALUE="high">
        <PARAM NAME="bgcolor" VALUE="#FFFFFF">
        <PARAM NAME="FlashVars" value="gphc=382" />
        <EMBED src="http://www.[site_url].com/images/imgs/flash_ad.swf?gphc=382" quality="high"WIDTH="728" HEIGHT="90" TYPE="application/x-shockwave-flash"  PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" FlashVars="gphc=382" />
    </OBJECT>
    Questions that I need answered ... How do we access the FlashVars or the URL Query String?  I have found many references to loaderInfo but no clear way to implement that I'm able to understand. So if the loaderInfo is the key, where do I add in the loaderComplete() function into my action script above in #1?
    function loaderComplete(myEvent:Event)
      var flashVars=this.loaderInfo.parameters;
      gphcTextField.text=flashVars.gphc
    this.loaderInfo.addEventListener(Event.COMPLETE, loaderComplete);
    Any help is much appreciated.

    Thank you for your input.  I implemented your sugguestion in the following way without any success.  Notice below in the addEventListner that I have added the snippet of code.  Is this a good place (correct place) to set the local_var?  I did confirm that the FlashVars and URL variables were set.
    sparkle.addEventListener(
         MouseEvent.MOUSE_DOWN,
         function(evt:MouseEvent):void {
             var url:String = "http://www.[site_url].com/as/img.cfm";
             var request:URLRequest = new URLRequest(url);
             var variables:URLVariables = new URLVariables();
             var local_gphc:String = LoaderInfo(this.root.loaderInfo).parameters.gphc;
             variables.gphc = local_gphc;
             request.data = variables;
             request.method = URLRequestMethod.GET;
           navigateToURL(request);
    Thank you for your help.

Maybe you are looking for