Accessing flashvars in AS3 - FlashPlayer

Hello,
I have a html file where I have defined a SWFObject with some flashvars, now I want to access these variables in my AS3 code of this SWF.
---------------------------HTML File ------------------------
<head>
     <title>Test</title>
     <style type="text/css">
          body { background-color: #fff; padding: 0 20px; color:#000; font: 13px/18px Arial, sans-serif; }
          a { color: #360; }
          h3 { padding-top: 20px; }
     </style>
     <script type="text/javascript" src="swfobject.js"></script>
        <script type="text/javascript">
            // For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection.
            var swfVersionStr = "10.0.0";
            // To use express install, set to playerProductInstall.swf, otherwise the empty string.
            var xiSwfUrlStr = "playerProductInstall.swf";
            var flashvars = {
                        'image':            'files/logo.jpg',
                       'file':               'http://demo.test.com/flash/streaming/dynamic.xml',
                       'autostart':           'true',
               'type': 'rtmp'
            var params = {};
            params.quality = "high";
            params.bgcolor = "#ffffff";
            params.allowscriptaccess = "always";
            params.allowfullscreen = "true";
            var attributes = {};
            attributes.id = "Player";
            attributes.name = "Player";
            attributes.align = "middle";
            swfobject.embedSWF(
                "Player.swf", "flashContent",
                "100%", "100%",
                swfVersionStr, xiSwfUrlStr,
                flashvars, params, attributes);
            // JavaScript enabled so display the flashContent div in case it is not replaced with a swf object.
            swfobject.createCSS("#flashContent", "display:block;text-align:left;");
        </script>
</head><head>
     I am trying to access the flashvars in my AS3 code of SWF file. I am using code like this :
        varName = LoaderInfo(this.root.loaderInfo).parameters.file;
But varName is always null, I don't what is the problem. can somebody please help me out of this. Thanks a lot !!

I just did this super simple example and works just fine.
HTML
<!DOCTYPE html>
<!-- html5 -->
<html>
    <head>
        <title>Test</title>
        <meta charset="UTF-8" />
        <script src="js/swfobject.js"></script>
        <script>
            var flashvars = {file:"http://demo.test.com/flash/streaming/dynamic.xml"};
            swfobject.embedSWF("player.swf", "flashContent", "320", "240", "10.0.0", null, flashvars);
        </script>
    </head>
    <body>
        <div id="flashContent"></div>
    </body>
</html>
player.swf
import flash.text.TextField;
var textfield:TextField = new TextField();
textfield.autoSize = "left";
textfield.text = loaderInfo.parameters.file;
addChild(textfield);
SWF displays "http://demo.test.com/flash/streaming/dynamic.xml" as expected.

Similar Messages

  • 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.

  • FlashVar in AS3

    I'm trying to figure out how to use FlashVars in ActionScript
    3.0. I'm familiar with _root in AS2 but I've learned it doesn't
    work in 3.0. I've played around with LoaderInfo that I know should
    do the trick but I can't seem to get it to work. And I can't seem
    to find any help in any of the many threads and forums I've visited
    today.
    So I'm putting my trust in you guys. I want my button
    ("button2") to open a link in another frame ("rightFrame") through
    a FlashVar.
    I'm quite new to flash and after much banging my head in the
    wall this is what I've come up with (obviously the _root doesn't
    work but if replaced by a hard coded url with
    http:// it works like a charm):
    var myLink:URLRequest = new URLRequest("_root.linkPigs);
    button2.addEventListener(MouseEvent.CLICK,onClick);
    function onClick(event:MouseEvent):void
    navigateToURL(myLink,"rightFrame");
    Hope you can help, thanks!

    BM.,
    > I'm familiar with _root in AS2 but I've learned it
    doesn't
    > work in 3.0.
    FlashVars data is indeed stored in the main timeline prior
    to AS3, but
    you don't necessarily need the _root prefix to get to those
    variables. As
    long as you scope your object references correctly, you could
    use (for
    example) _parent from code inside a movie clip that sits in
    the main
    timeline. In other words, it's not _root that does the trick
    in AS1/AS2,
    but rather, knowing that your FlashVars data is located in
    the main
    timeline.
    > I've played around with LoaderInfo that I know should do
    > the trick but I can't seem to get it to work.
    You're on the right path. :) In AS3, FlashVars data is still
    retrievable in terms of the main timeline, only it's
    organized into the
    LoaderInfo instance associated with that timeline. Because
    the main
    timeline extends MovieClip (or Sprite), which in turn extends
    the
    DisplayObject class (further down its family tree), the main
    timeline
    features a property called loaderInfo, which references the
    LoaderInfo
    instance you need.
    var myLink:URLRequest = new
    URLRequest(root.loaderInfo.parameters.linkPigs);
    button2.addEventListener(MouseEvent.CLICK,onClick);
    function onClick(event:MouseEvent):void {
    navigateToURL(myLink,"rightFrame");
    In fact, you may not even need the "root" at the beginning
    of the
    expression inside the URLRequest constructor; it all depends
    where this code
    is being written. If this code is in a keyframe of the main
    timeline, then
    it's already in what's known as root, so the mention of
    loaderInfo is enough
    to retrieve the LoaderInfo.parameters property of that
    reference, which in
    turn gives you access to your custom linkPigs property.
    David Stiller
    Co-author, Foundation Flash CS4 for Designers
    http://tinyurl.com/5j55cv
    "Luck is the residue of good design."

  • Setting flashvars in AS3 when testing movie

    Does anyone know how to set flashvars when running a movie in CS4 using Control->Test Movie?  Under ActionScript 2 I could just set _root.flashVar, what's the equivalent in AS3?

    Hi Dan,
    Thanks, but I'm not quite understanding what this solution is.  Is the AS2 that you're thinking in terms of when you're posting this solution?
    In AS3, the flashvar parameters don't appear as top level properties, they are found under "root.loaderInfo.parameters".  So I can look up a parameter like this:
    trace("myVar=" + root.loaderInfo.parameters.myVar);
    I'd like to be able to do something like setting this parameter in my test code like this:
    root.loaderInfo.parameters.myVar="test value";
    ...but this doesn't seem to work.  No error message when I try this (either running "Test Movie" in CS4 or running in Flash Player in FireFox).  Looking at the doc page for flash.display.LoaderInfo, it says that the "parameters" property is readonly.
    I wish there were some kind of dialog in CS4 to allow me to set up flash vars for testing under Control->Test Movie, but if there is such a thing, I haven't found it yet!
    - Bruce

  • FlashVars into AS3 Project.....!!?

    I am working in AS3, I know what needs to be done in AS2. I am needing to pass the FlashVars value to my swf. the FlashVars variable statement for this example is hard coded, but is actually dynamic data being passed from CF. So, to simplify this, I hard coded the FlashVars variable.
    So, I am having trouble passing the FlashVars variable in the following code to the AS3 coding below. Instead of "data/cgal.xml", I need it to pass the variable and dynamically read "http://www.stuartsandlin.com/adirectory/anxmlfile.xml".
    I'm sure can't be that much different from AS2.
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="100%" height="100%" id="main" align="middle">
    <param name="allowScriptAccess" value="sameDomain" />
    <param name="allowFullScreen" value="true" />
    <param name="movie" value="main.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" />
    <param name="FlashVars" value="http://www.stuartsandlin.com/adirectory/anxmlfile.xml" />
    <embed src="main.swf" quality="high" bgcolor="#000000" width="100%" height="100%" name="main" align="middle" allowScriptAccess="sameDomain" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
    </object>
    var loaderXML:URLLoader = new URLLoader();
    LoaderXML.load(NewURLRequest("data/cgal.xml"));

    actually you need to fix your html:
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#ve rsion=9,0,0,0" width="100%" height="100%" id="main" align="middle">
    <param name="allowScriptAccess" value="sameDomain" />
    <param name="allowFullScreen" value="true" />
    <param  name="movie" value="main.swf" /><param name="quality"  value="high" /><param name="bgcolor" value="#000000" />
    <param name="FlashVars" value="xmlVar=http://www.stuartsandlin.com/adirectory/anxmlfile.xml" />
    <embed src="main.swf" FlashVars="xmlVar=http://www.stuartsandlin.com/adirectory/anxmlfile.xml"  quality="high" bgcolor="#000000" width="100%" height="100%" name="main"  align="middle" allowScriptAccess="sameDomain" allowFullScreen="true"  type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
    </object>
    and that actionscript:
    var loaderXML:URLLoader = new URLLoader();
    LoaderXML.load(NewURLRequest(LoaderInfo(loaderInfo).parameters["xmlVar"]));
    and if you're using a tlf textfield that's loaded you may need an additional step.

  • Getting started with flashvars (basic)

    I want to learn how to use flashvars, so went to a bunch of
    websites, but I couldn't get it to work.
    one of the pages I tried to use was this one:
    http://blog.six4rty.ch/tutorials/flash-flashvars-in-as3/
    I made a new flash file, and added the code to the first
    frame(shown below), I published it as swf and html, then added, the
    flashvars tags to the html file
    quote:
    <param name="FlashVars" value="myFlashVar=THIS IS MY
    TEXT"></param>
    flashVars="myFlashVar=THIS IS MY TEXT"
    Nothing shows up in the embedded swf , when I open the html
    file.
    I tried as many different webpages as I could find for help,
    but none of them are working for me.
    a folder has all of these files in it:
    1. FlashVarsAttempt.swf
    2. FlashVarsAttempt.html
    3. AC_RunActiveContent.js
    4. FlashVarsAttempt.fla
    the code in these files is show below.
    please help

    I'll admit I haven't read through every detail of your code,
    but I can show you some code I use that has been working for me.
    In my PHP page I have the following for the js command to
    load the swf:
    AC_FL_RunContent(
    'codebase', '
    http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
    'width', '800',
    'height', '600',
    'src', 'SimpleChat',
    'quality', 'high',
    'pluginspage', '
    http://www.macromedia.com/go/getflashplayer',
    'align', 'middle',
    'play', 'true',
    'loop', 'true',
    'scale', 'showall',
    'wmode', 'window',
    'devicefont', 'false',
    'id', 'SimpleChat',
    'bgcolor', '#ffffff',
    'name', 'SimpleChat',
    'menu', 'true',
    'allowFullScreen', 'false',
    'allowScriptAccess','sameDomain',
    'movie', 'SimpleChat',
    'salign', '',
    'flashvars', 'intSessionID=<?php
    printf("%u",$session_id); ?>&intUserID=<?php
    printf("%u",$user_id); ?>'
    ); //end AC code
    The code in my actionscript that accesses these values is:
    intSessionID = root.loaderInfo.parameters.intSessionID;
    intUserID = root.loaderInfo.parameters.intUserID;
    Can you use something similar? I know it won't solve the
    situation with noscript, but in the interest of getting something
    working maybe it'll help. Good luck! :)
    Dave

  • How to use tile map with AS3?

    I have a file that contains a bunch of isometric tiles that I need to make a map with, much like a sprite sheet but not for making animations. So using AS3, how can I divide that file into the different tiles, knowing the coordinates of each of them. Or can it be done automatically in Flash itself, so I can access each tile from AS3?
    Furthermore I've been a programmer for a couple of decades but I am new to Flash. I know there are a ton of DisplayObjects like Bitmap, Sprite, Shape, MovieClip, Symbol etc. But which one would be better to use for that file? I need to access it from AS3 as described above, but I don't need it to react to mouse events, stretch or have children, just extract each tile and move it onto the stage with AS3.
    It seems to be down to a choice between Bitmap and Shape, since they're both lightweight, but I couldn't find out what the advantages and disadvantages of them are, as there was no comparison between those two on Google, though between a lot of the other objects. And Symbol seems like an idea too, since when I googled this, I found a lot of pages saying that you should convert a Bitmap to a Symbol, but I never found out why.
    Oh, and since I'm building an isometric map, all the tiles and all other graphics I'll be using, will be Bitmap and not Vector since I'm drawing the graphics in pixelart.

    create one tile symbol (movieclip or sprite so you can use actionscript to reference tile properties - like its x and y) and arrange them (using code or by hand) into your map.
    enable the cacheAsBitmap property of your map (that has some number of tile children).
    assign the mouseEnabled property of the map to false and its mouseChildren property to false.

  • Is ColdFusion the solution for me?

    I've recently started working with Air for a client and I've been having somewhat of a hard time converting.  I'm normally a .net developer so I'm trying to overcome my learning curve.  I'd like to know if ColdFusion would be a good solution for the problem I'm facing.
    I have an Air application that needs access to a simple xml file that sits on an external server.  This file can't be exposed for security reasons.  The security can be simple, I just don't want any random person being able to view it via a link.  I noticed ColdFusion could help here.  It seems as though I may be able to use the URLLoader with a URLVariable and call a ColdFusion application that's on the server that has access to the document.  Is this the case or am I oversimplifying this.  I got the idea from an example http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7cfd.html#WS5b3cc c516d4fbf351e63e3d118666ade46-7cb2.  If this is the case, I'll get CF and all will be well in the world.
    My other solution was to write a .Net web service and try to access it with AS3 but that seems fairly messy to me.  I also considered a PHP script that could give it to me but that as well seems messy.
    So I ask, is CF for me?
    I appreciate any help.  This is a new concept and a new development environment so I apologize in advance.

    Price aside, would CF work for my solution?  Here is what I'm thinking.  I'm sure this isn't correct but should give an understanding.  If I use the following code(I'd add in some variables later):
    <cfset myXML= XMLParse(ExpandPath("xmlDoc.xml"))>
    <cfoutput>outputXML=myXML</cfoutput>
    And make a simple call to it like this:
    var request:URLRequest = new URLRequest();
    request.url = "myaddress.com/xmlReader.cfm;
    request.method = URLRequestMethod.POST;
    var loader:URLLoader = new URLLoader().
    //add the rest of the code here
    Am I oversimplifying this or would it reabe this simple?  If it is this simple, I don't mind making this investment.  I could use this kind of functionality on a few other applications I intend on making and I'm sure I can find new uses once I dig into CF.
    As far as price, it looks like the standard edition is in my price range if I'm correct.  I was pricing the enterprise edition previously.

  • SQL Server 2005 Endpoints

    Hello,
    I am trying to fetch data from SQL Server 2005, bypassing
    IIS. SQL 2005 Endpoints require a username and password and don't
    support anonymous access. How can I send a username and password
    for authentication? This is the Flex 2 Beta 2 code I am using to
    call the service:
    <mx:WebService id="zoban" wsdl="
    http://zoban/Library?WSDL">
    <mxperation name="GetBooks">
    <mx:request>
    <Text>{kaka.text}</Text>
    </mx:request>
    </mxperation>
    Well, this does not work. If I point my browser to the
    service I get the username popup - prompt.
    Can I squeeze in something like <mx:username> and
    <mxassword> in the flex code?
    Best!

    WELL NEXT WAS UR QUESTION OF using a query string parameter
    pART 2 Passing request data into Flex applications
    You can pass request data to Flex applications by using a
    query string parameter or defining flashVars properties in the HTML
    wrapper. When you use query string parameters, Flex converts them
    to flashVars variables and passes them to the application.
    Inside the Flex application, you access flashVars properties
    and query string parameters exactly the same way, but the way that
    you pass them to the Flex application is different:
    * The flashVars properties: You explicitly define the
    flashVars properties in the HTML wrapper that points to the Flex
    application.
    * Query string parameters: You attach query string parameters
    to the URL in the browser's target window and the Flex Enterprise
    Services 2.0 converts them to flashVars variables.
    Changing either the query string parameter or the flashVars
    property does not trigger a recompilation of the Flex application
    if you are using the Flex Enterprise server.
    To use flashVars or query string parameters inside your MXML
    file, you access the Application.application.parameters object. The
    parameters property points to a dynamic object that stores each
    parameter as a name-value pair. You can access variables on the
    parameters object by specifying parameters.variable_name. As with
    any variable, you can bind the parameters object's properties to a
    display control or modify the value and return it to another
    function.
    The following example defines the myName and myHometown
    variables and binds them to the text of Label controls:
    <mx:Application xmlns:mx="
    http://www.macromedia.com/2005/mxml"
    creationComplete="initVars()">
    <mx:Script><![CDATA[
    // Declare bindable properties in Application scope.
    [Bindable]
    private var myName:String;
    [Bindable]
    private var myHometown:String;
    // Assign values to new properties.
    private function initVars():void {
    myName = Application.application.parameters.myName;
    myHometown = Application.application.parameters.myHometown;
    ]]></mx:Script>
    <mx:VBox>
    <mx:HBox>
    <mx:Label text="Name: "/>
    <mx:Label text="{myName}" fontWeight="bold"/>
    </mx:HBox>
    <mx:HBox>
    <mx:Label text="Hometown: "/>
    <mx:Label text="{myHometown}" fontWeight="bold"/>
    </mx:HBox>
    </mx:VBox>
    </mx:Application>
    When a user requests this application with the myName and
    myHometown parameters defined, Flex displays their values in the
    Label controls. The following URL passes the name Nick and the
    hometown San Francisco to the Flex application:
    http://localhost:8100/flex/myApp.swf?myName=Nick&myHometown=San%20Francisco
    To view all the flashVars properties, you can iterate over
    the parameters object, as the following example shows:
    for (var i:String in Application.application.parameters) {
    ta1.text += i + ":" + Application.application.parameters +
    "\n";
    Flex does not recompile the application if the request
    variables have changed. As a result, if you dynamically set the
    values of the flashVars properties or query string parameters, you
    do not force a recompilation.
    Query string parameters must be URL encoded. The format of
    the string is a set of name-value pairs separated by an ampersand
    (&. You can escape special and nonprintable characters with a
    percent symbol (%) followed by a two-digit hexadecimal value. You
    can represent a single blank space using the plus sign (+).
    The encoding for flashVars properties and query string
    parameters is the same as the page. Internet Explorer provides
    UTF-16-compliant strings on the Windows platform. Netscape sends a
    UTF-8-encoded string to Flash Player.
    Most browsers support a flashVars String or query string up
    to 64 KB (65535 bytes) in length. They can include any number of
    name-value pairs.

  • MSSQL2005 Endpoint  (Webservice) Authentication

    Hello,
    I am trying to fetch data from SQL Server 2005, bypassing
    IIS, SQL 2005 Endpoints require a username and password and don't
    support anonymous access. How can I send a username and password
    for authentication? This is the Flex 2 Beta 2 code I am using to
    call the service:
    <mx:WebService id="zoban" wsdl="
    http://zoban/Library?WSDL">
    <mx
    peration name="GetBooks">
    <mx:request>
    <Text>{kaka.text}</Text>
    </mx:request>
    </mx
    peration>
    When I point my browser to the service I just get the
    username prompt. Can I squeeze in something like
    <mx:username> and <mx
    assword> in there?
    Best!

    WE;; NEXT WAS UR QUESTION OF using a query string parameter
    pART 2 Passing request data into Flex applications
    You can pass request data to Flex applications by using a
    query string parameter or defining flashVars properties in the HTML
    wrapper. When you use query string parameters, Flex converts them
    to flashVars variables and passes them to the application.
    Inside the Flex application, you access flashVars properties
    and query string parameters exactly the same way, but the way that
    you pass them to the Flex application is different:
    * The flashVars properties: You explicitly define the
    flashVars properties in the HTML wrapper that points to the Flex
    application.
    * Query string parameters: You attach query string
    parameters to the URL in the browser's target window and the Flex
    Enterprise Services 2.0 converts them to flashVars variables.
    Changing either the query string parameter or the flashVars
    property does not trigger a recompilation of the Flex application
    if you are using the Flex Enterprise server.
    To use flashVars or query string parameters inside your MXML
    file, you access the Application.application.parameters object. The
    parameters property points to a dynamic object that stores each
    parameter as a name-value pair. You can access variables on the
    parameters object by specifying parameters.variable_name. As with
    any variable, you can bind the parameters object's properties to a
    display control or modify the value and return it to another
    function.
    The following example defines the myName and myHometown
    variables and binds them to the text of Label controls:
    <mx:Application xmlns:mx="
    http://www.macromedia.com/2005/mxml"
    creationComplete="initVars()">
    <mx:Script><![CDATA[
    // Declare bindable properties in Application scope.
    [Bindable]
    private var myName:String;
    [Bindable]
    private var myHometown:String;
    // Assign values to new properties.
    private function initVars():void {
    myName = Application.application.parameters.myName;
    myHometown = Application.application.parameters.myHometown;
    ]]></mx:Script>
    <mx:VBox>
    <mx:HBox>
    <mx:Label text="Name: "/>
    <mx:Label text="{myName}" fontWeight="bold"/>
    </mx:HBox>
    <mx:HBox>
    <mx:Label text="Hometown: "/>
    <mx:Label text="{myHometown}" fontWeight="bold"/>
    </mx:HBox>
    </mx:VBox>
    </mx:Application>
    When a user requests this application with the myName and
    myHometown parameters defined, Flex displays their values in the
    Label controls. The following URL passes the name Nick and the
    hometown San Francisco to the Flex application:
    http://localhost:8100/flex/myApp.swf?myName=Nick&myHometown=San%20Francisco
    To view all the flashVars properties, you can iterate over
    the parameters object, as the following example shows:
    for (var i:String in Application.application.parameters) {
    ta1.text += i + ":" + Application.application.parameters
    + "\n";
    Flex does not recompile the application if the request
    variables have changed. As a result, if you dynamically set the
    values of the flashVars properties or query string parameters, you
    do not force a recompilation.
    Query string parameters must be URL encoded. The format of
    the string is a set of name-value pairs separated by an ampersand
    . You can escape special and nonprintable characters
    with a percent symbol (%) followed by a two-digit hexadecimal
    value. You can represent a single blank space using the plus sign
    (+).
    The encoding for flashVars properties and query string
    parameters is the same as the page. Internet Explorer provides
    UTF-16-compliant strings on the Windows platform. Netscape sends a
    UTF-8-encoded string to Flash Player.
    Most browsers support a flashVars String or query string up
    to 64 KB (65535 bytes) in length. They can include any number of
    name-value pairs.

  • Problems with RemoteObject and security sandbox errors

    I'm having trouble with an AS3 AMF RemoteObject request that is hosted on Google App Engine. I have a crossdomain.xml file in the root of the domain, and also one at the remoting endpoint.
    Here are the contents of the root crossdomain.xml:
    <?xml version="1.0"?>
    <cross-domain-policy>
    <site-control permitted-cross-domain-policies ="all"/>
    <allow-access-from domain="*.appspot.com"/>
    <allow-access-from domain="*.{appid}.appspot.com"/>
    <allow-access-from domain="*.{appid}.com"/>
    <allow-access-from domain="*.{appid}.org"/>
    </cross-domain-policy>
    I have replaced my application's ID with {appid}. In the endpoint crossdomain.xml, it says the exact same thing, except it omits the <site-control> tag.
    Loading the swf file and testing it on my machine works just fine... I think that may have something to do with me having the debugger version of Flash Player. When I push it up to App Engine to make it public, other clients access it and get a Client.Error.MessageSend Channel.Security.Error error Error #2048 url: http://05-alpha.latest.{appid}.appspot.com/_rpc/data.
    I am using Flex 4 beta, and the App Engine Python runtime. I have tried full wildcard in the crossdomain, and even accessing the data endpoint at a relative URL so as to avoid this error.
    Someone please help! Thanks in advance.

    The error happens regardless of where I access it (the beta URL, the production URL, etc).
    That's literally all the actionscript code for the remote object... I've included an extended snippet below, but I have no idea why the SWF would be trying to access localhost.
    Even on my development machines (where it seems to work), there's nothing running on the host/port combo it's trying to access.
    Extended AS3:
    FatCatStage.mxml:
    <s:RemoteObject id="dataService" showBusyCursor="false" destination="data" endpoint="/_rpc/data" />
    main.mxml:
    <fx:Script>
    <![CDATA[
                   fatCatStage.dataService.RetrieveFirstGraph.addEventListener( ResultEvent.RESULT, fatCatStage.graphInitialize );
    fatCatStage.dataService.RetrieveFirstGraph();
    public function doGraphChange(event:ResultEvent):void
    if(event.result.result!='failure')
    var GraphData:Object = event.result.response;
    this.lastGraphData = GraphData;
    fatCatViz.removeAll()
    var root:GenericSprite = fatCatViz.addNodeElement(GraphData.object,null,this.center,GraphData.object.key);
    for each ( var Connection:Object in GraphData.object.connections )
    this._recursiveGraph(root, Connection, center, 3);
    else
    Alert.show('There was an internal graphing error. Please try again.');
    fatCatViz.updateInternalStructure();
    this.intervalSet = setInterval(timedReLayout,500);
    ]]>
    </fx:Script>
    That's all of the relevant actionscript for the entire application. Where is it referencing localhost?

  • Problems with RemoteObject?

    I've got an application that uses RemoteObjects, built for web.  I'm porting it to AIR now, but the RemoteObject code which works just fine built for web is failing when built for AIR.
    When I invoke a method on a RemoteObject, I get a fault with the following error condition:
    faultDetail    "Channel.Connect.Failed error Invalid URL url: 'null'"
    What's strange is that I have verified that the URL going into the Channel.  And as I said, this code works perfectly when built for web.
    Using Flex 4 with the latest AIR SDK.
    I've tried setting the endpoint directly, which gives the same result.  Also please note I'm not using MXML to create my RO's, I'm doing it all in AS3 using ChannelSets and all that.
    Any ideas what's wrong?
    Thanks!
    Craig

    The error happens regardless of where I access it (the beta URL, the production URL, etc).
    That's literally all the actionscript code for the remote object... I've included an extended snippet below, but I have no idea why the SWF would be trying to access localhost.
    Even on my development machines (where it seems to work), there's nothing running on the host/port combo it's trying to access.
    Extended AS3:
    FatCatStage.mxml:
    <s:RemoteObject id="dataService" showBusyCursor="false" destination="data" endpoint="/_rpc/data" />
    main.mxml:
    <fx:Script>
    <![CDATA[
                   fatCatStage.dataService.RetrieveFirstGraph.addEventListener( ResultEvent.RESULT, fatCatStage.graphInitialize );
    fatCatStage.dataService.RetrieveFirstGraph();
    public function doGraphChange(event:ResultEvent):void
    if(event.result.result!='failure')
    var GraphData:Object = event.result.response;
    this.lastGraphData = GraphData;
    fatCatViz.removeAll()
    var root:GenericSprite = fatCatViz.addNodeElement(GraphData.object,null,this.center,GraphData.object.key);
    for each ( var Connection:Object in GraphData.object.connections )
    this._recursiveGraph(root, Connection, center, 3);
    else
    Alert.show('There was an internal graphing error. Please try again.');
    fatCatViz.updateInternalStructure();
    this.intervalSet = setInterval(timedReLayout,500);
    ]]>
    </fx:Script>
    That's all of the relevant actionscript for the entire application. Where is it referencing localhost?

  • Insert response from adobe captivate to database

    Need ApI to communicate to adobe captivate to insert data in
    database

    Hi tikiri,
    You can access variables directly using the movie instance.
    Please check the code below, where we are printing the varCount
    variable.
    on(release){
    _root.play();
    _root.createEmptyMovieClip("movie", 999);
    _root.movie._x=146;
    _root.movie._y=12;
    loadMovie("test/test.swf", _root.movie);
    trace (_root.movie.varCount);
    This code is specific for AS2 captivate swfs. You can try
    accessing any of captivate system variables also in this way:
    _root.movie.rdcmndNextSlide = 1; // jumps to next slide
    _root.movie.cpCmndMute = 1; // mute the audio
    trace(_root.movie.cpInfoCurrentDate); // print the current
    date
    _root.movie.rdInfoCurrentSlide =
    _root.movie.cpInfoLastVisitedSlide // jumps to last visited slide
    Please go through the list of available variables in
    captivate documentation. All the variables starting from "rdcmnd"
    are legacy variables and exist in captivate 3 projects as well.
    Ones starting with "cp" are new and are not available prior to
    captivate 4. Accessing method remains the same for both cp3 and cp4
    generated swfs.
    For accessing variables in AS3 captivate movies:-
    var movieLdr:Loader = new Loader();
    var movieURL:String = "CA3_Demo.swf"
    var movieURLReq:URLRequest = new URLRequest(movieURL);
    var cpMovie;
    movieLdr.addEventListener(Event.COMPLETE,loadComplete);
    function loadComplete(ae:Event)
    cpMovie = movieLdr.content;
    //Pause the movie
    cpMovie.rdcmndPause = 1;
    //Resume the movie
    cpMovie.rdcmndResume = 1;
    //Jump to next slide
    cpMovie.rdcmndNextSlide = 1;
    also try,
    // print current date
    trace(cpMovie.movie.cpInfoCurrentDate);
    addChild(movieLdr);
    movieLdr.load(movieURLReq);

  • Variables from Adobe Captivate to flash

    Hi,
    can anybody explain me, how to acces variables in captivate
    from flash?
    I can't export my CP file to Flash CS3, there is an alert
    message
    The following elements in your project have not been
    converted. They are not supported by this importer.
    Question slide
    508 compliance
    A swf animation slide has been imported. The following files
    must be made available at publish time:
    DefaultPreloader.swf
    Please make sure you publish the project to "D:\MyQuizzes\".
    Saving the project to this directory will ensure that test
    project will work with the swf animation slide.
    Thanks for answer...

    Hi tikiri,
    You can access variables directly using the movie instance.
    Please check the code below, where we are printing the varCount
    variable.
    on(release){
    _root.play();
    _root.createEmptyMovieClip("movie", 999);
    _root.movie._x=146;
    _root.movie._y=12;
    loadMovie("test/test.swf", _root.movie);
    trace (_root.movie.varCount);
    This code is specific for AS2 captivate swfs. You can try
    accessing any of captivate system variables also in this way:
    _root.movie.rdcmndNextSlide = 1; // jumps to next slide
    _root.movie.cpCmndMute = 1; // mute the audio
    trace(_root.movie.cpInfoCurrentDate); // print the current
    date
    _root.movie.rdInfoCurrentSlide =
    _root.movie.cpInfoLastVisitedSlide // jumps to last visited slide
    Please go through the list of available variables in
    captivate documentation. All the variables starting from "rdcmnd"
    are legacy variables and exist in captivate 3 projects as well.
    Ones starting with "cp" are new and are not available prior to
    captivate 4. Accessing method remains the same for both cp3 and cp4
    generated swfs.
    For accessing variables in AS3 captivate movies:-
    var movieLdr:Loader = new Loader();
    var movieURL:String = "CA3_Demo.swf"
    var movieURLReq:URLRequest = new URLRequest(movieURL);
    var cpMovie;
    movieLdr.addEventListener(Event.COMPLETE,loadComplete);
    function loadComplete(ae:Event)
    cpMovie = movieLdr.content;
    //Pause the movie
    cpMovie.rdcmndPause = 1;
    //Resume the movie
    cpMovie.rdcmndResume = 1;
    //Jump to next slide
    cpMovie.rdcmndNextSlide = 1;
    also try,
    // print current date
    trace(cpMovie.movie.cpInfoCurrentDate);
    addChild(movieLdr);
    movieLdr.load(movieURLReq);

  • D namespace attributes questions

    Not sure these are actually Catalyst questions, but they are part of the workflow through Catalyst, so:
    1) Are the "d" namespace attributes (such as "userLabel") compiled into the SWF when compiling in Builder?
    For instance:
    <s:TextInput skinClass="components.UserTextField" text="Username" d:userLabel="UserTextField" x="43" y="82"/>
    1a) If so, how can I access them in AS3?
    1b) If not, what's the use? I know -- they carry over some useful data, but is there something we can do with them in Builder other than search and replace?
    Thanks,
    Kirk

    Hi Kirk,
    Any attribute that has a prefix (d:, th:, ai:, etc) is completely ignored by the compiler and is not accessible at runtime. They are called "private attributes".
    They are not directly useful in Builder. Feel free to strip them out.
    -Adam

Maybe you are looking for