Can't receive variables from HTML to Flash in AS3 passed via URL (not Flashvars)

hey all,
can't seem to get AS3 to recognize variables passed via URL
(not Flashvars). i can get vars passed with Flashvars in the
javascript but I don't want to use that method. i'm simply
extending the .swf call with .swf?var=123 in the embed and on the
AS3 side i'm calling loaderInfo.parameters.var
thought this would work but doesn't. what am i doing wrong?
HTML:
<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="1024" height="768" id="main" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="main.swf?var=123"
/><param name="quality" value="best" /><param
name="bgcolor" value="#ffffff" /> <embed
src="main.swf?var=123" quality="best" bgcolor="#ffffff"
width="1024" height="768" name="main" align="middle"
allowScriptAccess="sameDomain" allowFullScreen="false"
type="application/x-shockwave-flash" pluginspage="
http://www.macromedia.com/go/getflashplayer"
/>
</object>
AS:
t = new TextField();
t.text = String(loaderInfo.parameters.var);
thx in adv.
michael

appreciate you were going for brevity, but i think the
answer's going to be hidden either in your complete html code or
your complete AS code. without seeing this i can only keep
guessing.
that said, my latest guess is that you're not passing your
variable within the AC_FL_RunContent function. there are two
properties set in this function - src and movie, which contain your
movie name, to which you can add any parameters you wish to pass.
eg.
'src', 'main?var=123',
'movie', 'main?var=123',
where main is the name of your swf and var the name of the
parameter you wish to pass.
if this function fails - if javascript isn't available in the
browser, for example, or AC_RunActiveContent.js is missing, then
the <object> tag you described is used. (this object tag is
sitting inside a <noscript> tag.)

Similar Messages

  • How to pass a variable from HTML to Flash

    I have built my flash ad banner in Flash 9 and now want the
    HTML code to pass the url over to the flash movie that it should
    jump to when clicked.
    The info in the help file seems out of date for the latest
    HTML template as it uses mainly JavaScript to get round IE's
    dreadful embeding issue. So my problem is, how do I pass a variable
    from the HTML to the actionScript specified int he Help file
    (running on a full screen button) as shown below?
    myButton_btn.onRelease = function() {
    if (clickTAG.substr(0, 5) == "http:") {
    getURL(clickTAG);
    via the html code now used by Flash 9 which is like this:
    <!-- saved from url=(0013)about:internet -->
    <html lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1" />
    <title>Advert_long</title>
    <script language="javascript"> AC_FL_RunContent = 0;
    </script>
    <script language="javascript"> DetectFlashVer = 0;
    </script>
    <script src="AC_RunActiveContent.js"
    language="javascript"></script>
    <script language="JavaScript" type="text/javascript">
    <!--
    // Globals
    // Major version of Flash required
    var requiredMajorVersion = 9;
    // Minor version of Flash required
    var requiredMinorVersion = 0;
    // Revision of Flash required
    var requiredRevision = 115;
    // -->
    </script>
    </head>
    <body bgcolor="#ffffff">
    <!--url's used in the movie-->
    <!--text used in the movie-->
    <!--
    Coping
    with
    Growing
    Audio
    Series
    Theraputic stories
    for children aged
    4 to 9
    -->
    <script language="JavaScript" type="text/javascript">
    <!--
    if (AC_FL_RunContent == 0 || DetectFlashVer == 0) {
    alert("This page requires AC_RunActiveContent.js.");
    } else {
    var hasRightVersion = DetectFlashVer(requiredMajorVersion,
    requiredMinorVersion, requiredRevision);
    if(hasRightVersion) { // if we've detected an acceptable
    version
    // embed the flash movie
    AC_FL_RunContent(
    'codebase', '
    http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0',
    'width', '120',
    'height', '600',
    'src', 'Advert_long',
    'quality', 'high',
    'pluginspage', '
    http://www.macromedia.com/go/getflashplayer',
    'align', 'middle',
    'play', 'true',
    'loop', 'true',
    'scale', 'showall',
    'wmode', 'window',
    'devicefont', 'false',
    'id', 'Advert_long',
    'bgcolor', '#ffffff',
    'name', 'Advert_long',
    'menu', 'true',
    'allowScriptAccess','sameDomain',
    'allowFullScreen','false',
    'movie', 'Advert_long',
    'salign', ''
    ); //end AC code
    } else { // flash is too old or we can't detect the plugin
    var alternateContent = 'Alternate HTML content should be
    placed here.'
    + 'This content requires the Adobe Flash Player.'
    + '<a href=http://www.macromedia.com/go/getflash/>Get
    Flash</a>';
    document.write(alternateContent); // insert non-flash content
    // -->
    </script>
    <noscript>
    // Provide alternate content for browsers that do not support
    scripting
    // or for those that have scripting disabled.
    Alternate HTML content should be placed here. This content
    requires the Adobe Flash Player.
    <a href="
    http://www.macromedia.com/go/getflash/">Get
    Flash</a>
    </noscript>
    </body>
    </html>

    You should use SWFObject to embed your Flash. Not only does
    it make
    embedding more straightforward, it makes passing query
    parameters very easy.
    Check out:
    http://code.google.com/p/swfobject/
    Dave -
    www.offroadfire.com
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • How to pass a variable from HTML to Flash 9

    I have built my flash ad banner in Flash 9 and now want the
    HTML code to pass the url over to the flash movie that it should
    jump to when clicked.
    The info in the help file seems out of date for the latest
    HTML template as it uses mainly JavaScript to get round IE's
    dreadful embeding issue. So my problem is, how do I pass a variable
    from the HTML to the actionScript specified int he Help file
    (running on a full screen button) as shown below?
    myButton_btn.onRelease = function() {
    if (clickTAG.substr(0, 5) == "http:") {
    getURL(clickTAG);
    via the html code now used by Flash 9 which is like this:
    <!-- saved from url=(0013)about:internet -->
    <html lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1" />
    <title>Advert_long</title>
    <script language="javascript"> AC_FL_RunContent = 0;
    </script>
    <script language="javascript"> DetectFlashVer = 0;
    </script>
    <script src="AC_RunActiveContent.js"
    language="javascript"></script>
    <script language="JavaScript" type="text/javascript">
    <!--
    // Globals
    // Major version of Flash required
    var requiredMajorVersion = 9;
    // Minor version of Flash required
    var requiredMinorVersion = 0;
    // Revision of Flash required
    var requiredRevision = 115;
    // -->
    </script>
    </head>
    <body bgcolor="#ffffff">
    <!--url's used in the movie-->
    <!--text used in the movie-->
    <!--
    Coping
    with
    Growing
    Audio
    Series
    Theraputic stories
    for children aged
    4 to 9
    -->
    <script language="JavaScript" type="text/javascript">
    <!--
    if (AC_FL_RunContent == 0 || DetectFlashVer == 0) {
    alert("This page requires AC_RunActiveContent.js.");
    } else {
    var hasRightVersion = DetectFlashVer(requiredMajorVersion,
    requiredMinorVersion, requiredRevision);
    if(hasRightVersion) { // if we've detected an acceptable
    version
    // embed the flash movie
    AC_FL_RunContent(
    'codebase', '
    http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0',
    'width', '120',
    'height', '600',
    'src', 'Advert_long',
    'quality', 'high',
    'pluginspage', '
    http://www.macromedia.com/go/getflashplayer',
    'align', 'middle',
    'play', 'true',
    'loop', 'true',
    'scale', 'showall',
    'wmode', 'window',
    'devicefont', 'false',
    'id', 'Advert_long',
    'bgcolor', '#ffffff',
    'name', 'Advert_long',
    'menu', 'true',
    'allowScriptAccess','sameDomain',
    'allowFullScreen','false',
    'movie', 'Advert_long',
    'salign', ''
    ); //end AC code
    } else { // flash is too old or we can't detect the plugin
    var alternateContent = 'Alternate HTML content should be
    placed here.'
    + 'This content requires the Adobe Flash Player.'
    + '<a href=http://www.macromedia.com/go/getflash/>Get
    Flash</a>';
    document.write(alternateContent); // insert non-flash
    content
    // -->
    </script>
    <noscript>
    // Provide alternate content for browsers that do not
    support scripting
    // or for those that have scripting disabled.
    Alternate HTML content should be placed here. This content
    requires the Adobe Flash Player.
    <a href="
    http://www.macromedia.com/go/getflash/">Get
    Flash</a>
    </noscript>
    </body>
    </html>

    You should use SWFObject to embed your Flash. Not only does
    it make
    embedding more straightforward, it makes passing query
    parameters very easy.
    Check out:
    http://code.google.com/p/swfobject/
    Dave -
    www.offroadfire.com
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • Passing dynamic variable from html to Flash

    I know this is pretty simple but all that I have read doesn't make much sense to me. I have one swf calling another swf that I have embedded into an htnl. In other words just calling another html page in a seperate window.
    In one.swf (runing in broswer) I use the below to call another html page passing the variable NewLessonArray. This contains an array of completed chapters.
    // LOADING URL
    var NewLessonCompleteArray:String = LessonCompleteArray.toString();
    navigateToURL(new URLRequest("two/index.html?CurrentLessonInfo=<NewLessonCompleteArray>"), "_blank");
    In the receiving swf I want to retrieve the passing parameters.
    two.swf
    // Getting the parameters passed
    this.loaderInfo.parameters.toString()
    All that is returned that I can see is object Object. But since I am passing on a address line into another swf embedded in a html page I am unable to determine that correct syntac for retrieving the information.
    Any suggestions? This has got to be pretty simple... I think.
    THANKS

    What you are trying to do is not extremely difficult to do, but it is not something I would consider as being simple.  With Andrei's approach you should be able to take the url String and dissect the parameters from it using String methods, like split().
    As for the loaderInfo end of things, you are not passing the parameters to the swf file, you are passing them to the html page.  So the loaderInfo won't have any info for you regarding the url parameters.  The loadInfo would typically get parameters via the FlashVars parameters passed in in the html's swf embedding code.
    Here are some other solutions that you might consider.  I have not dealt with these myself, they are merely in my collection of useful info, so you might have to experiment to get them working.  One is a link to a class-based approach and the other is an approach that use swfObject embedding to dynamically add the parameters as FlashVars to the embedding code....
    http://mikethenderson.com/2009/02/as3-return-query-string-value-version-2/#more-105
    OR
    In your HTML:
    var flashvars = {};
    if (swfobject.getQueryParamValue("aParameter")) {
      flashvars.param = swfobject.getQueryParamValue("aParameter"); 
    swfobject.embedSWF("myMovie.swf", "myContent", "550", "400", "9.0.0", "", flashvars);
    And the param variable will be available as a FlashVar to your movie:
    var theParam = loaderInfo.parameters.param;

  • Passing variable from html to flash

    Hi I have built a flash movie with buttons...depending on
    which button is clicked it loads a different flash movie due to
    variable setting. I am able to set and call the variable s in flash
    fine
    But now i have an html page that needs to blend with this
    flash...So i created buttons on my html page to look like the
    flash...But when i click a certain button i want it to know the
    variable going into the flashpage and load correct movie...not just
    go to the beginning of my flash movie then user will have to choose
    the button again...
    How can i do this?
    thank you in advance
    reno

    well, between the post to forum and this link below i got
    this to work for me
    Just needed to know about the javascript....along with
    putting the value/variable in url as posted..thanks
    http://noscope.com/journal/2003/12/query_string
    thanks for replying with suggestions!
    reno

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

  • Send data from html to flash action script

    Hi,
    I would like my flash to act differently depending on what
    html page it is on. Can I send information from html code to action
    script?

    Hi,
    Yes you can, by using FLASHVARS. Refer the attached code for
    example. Also you can use Javascript setVariable method of Flash
    object to set values in between i.e. after the page has loaded, as
    in case of FLASHVARS these are sent to flash just at the begining
    i.e. once SWF loads. In the attached exmple i've sent 2 variables
    to Flash one is 'username' and other is 'userId', thse will be
    fetched inside flash movie as _root.username and _root.userId.
    Note: I've added flashvars as PARAM and also as an attribute
    for EMBED tag (used by Mozilla, NS etc)
    Hope this helps.
    Thanks,
    Sumeet

  • HT1277 I can send & receive email from my ipad but for some reason I can no longer do this from my i mac.It keeps telling me that the password is not valid with the imap server.I keep entering the password but it won't accept it.

    I can send & receive email from my ipad but for some reason I can no longer do this from my i mac.It keeps telling me that the password is not valid with the imap server.I keep entering the password but it won't accept it.

    Do you have one, two or more entries in the left colum of Mail.app for your mail server(s)?  That is, do you have your Mail.app set up with either a btinternet entry, with a btyahoo entry, or both?  Or more?
    I'm guessing that you might have one account (btyahoo?) listed for incoming (IMAP server) mail, and with the outbound (SMTP server) mail is configured and named btinternet.
    Based on what little I see posted, it looks like BT uses both btinternet and btyahoo, but I'm not exactly clear on how they have their stuff set up, and their web set gets helpful and tries to help configure my mail — I don't immediately see a single web page with the mail server set-up details.  The BT email client set-up starts here.

  • Can't receive email from Mail 3.4 and I can't get rid of a draft email

    OK, two problems here...
    1 The most frustrating is that I can't receive mail from Mail 3.4. I can send and my wife's email account is working fine. I've got a green light from the "Mail Connection Doctor" and I haven't changed any settings that I know of. I've been accessing my mail thru me.com now, it's working OK but not like "Mail".
    and
    2 I have this piece of email that I sent...the guy received it...and it keeps showing up in my "Drafts" mailbox. I delete it, then it comes back, sometimes multiple copies! I've been getting an error message....
    "Some actions taken while the account “Joe's Email” was offline could not be completed online."
    "Mail has undone actions on some messages so that you can redo the actions while online. Mail has saved other messages in mailbox “On My Mac” in “On My Mac” so that you can complete the actions while online.
    Additional information: The connection to the server “mail.mac.com” on port 143 timed out."
    Now my airport connection has been on and off with this machine (my old powerbook has been rock solid on the same network) so the "timed out" portion is probably true...but why can't I just get ride of this email message?
    Thanks for the help

    I think I've got it fixed....I "reset" my mail program, I deleted my mailbox then re-created it and I'm all set for now.

  • CAN I RECEIVE MESSAGE FROM MY CELLULAR SERVICE PROVIDER IN MY iPAD MINI CELLULAR ?

    Hi Using iPad,
    Can I receive message from my cellular service provider in my iPad mini cellular?

    I Picked This Username wrote:
    Be aware though..
    If you send an iMessage to an iPhone that isn't using WiFi, they will be charged for receiving the message..
    The same goes with the iPad sending the message: if you are not using WiFi..
    That is incorrect. No cell carrier charges for a message sent by and received by iMessage other than any relevant data charges. The carrier doesn't even know the message is any different from an email message or any other standard Internet traffic. Only if the iPhone was not set up to iMessage and hence receives the message via SMS would there perhaps be a charge, and that will depend on the cell plan. The iPad cannot receive messages via SMS at all so there will never be a charge.
    Regards.

  • Hi, my iPhone was stolen and now i can't receive messages from people with iPhones. What do i do to fix this problem, and get my old messages? This has been a problem for 3 weeks!

    Hi, my iPhone was stolen and now i can't receive messages from people with iPhones. What do i do to fix this problem, and get my old messages? This has been a problem for 3 weeks!

    This won't get your old messages back but will help with new ones: https://selfsolve.apple.com/deregister-imessage

  • I can send messages however i can't receive messages from everyone. only some contacts

    i can send messages however i can't receive messages from everyone. only some contacts

    Yes, I already talked about this to my carrier. Do you think it doesn't have any problem with the phone?

  • TS5185 i have turned off my Imessage but I still can't receive text from anyone using an Iphone

    I switched from iPhone 4s to a galaxy note 2 but I can't receive messages from other iPhone users. . I turned off my Imessage but I still can't receive any

    Hi there.
    Had exactly the same issue, and i've sorted this out now. It IS Apple's responsibility to deactivate this function, and simply switching their imessage off on a handset will NOT work.
    Whatever apple did, they effectively released my number (read: t-mobile's number) from their messaging / OS framework's grip.
    Please read my explanation here:
    https://discussions.apple.com/message/24488400#24488400
    You will need to contact apple support according to my solution.
    Whatever it was they did, and i can guarantee that they did SOMETHING to release my (t-mobile's) number from their ecosystem, even though they did not specify step two (whatever they did after instructing me to deactivate imessage on their handset - which i explained i had already done), it has now returned my SMS delivery and receipt status to normal, and i can send and receive to everyone and anyone in my Contact List.

  • Can I receive messages from Skype when my ipad is in sleep mode and the app is closed?

    Ok, can I receive messages from Skype when my ipad and iPod touch are off, and the app is closed? Becuase my mom sent me a message and I did nott receive it. I have to have the app running or running in the background to receive messages. Is there a way to recieve messages when my ipad and ipod do NOT have the app running?

    The ipad may keep a connection alive in sleep mode.. but it should only use local connection AFAIK, and no internet content.
    I have a similar setup with iPad and although it has an IP it is not actually reachable on the network. I will track usage and see if it is actually using anything but I would doubt it.
    Now of course it may depend on what apps you have running. I really doubt the ipad will be using that much of your download unless you are watching movies on it.

  • Eversince installed Mountain Lion, i can't receive emails from my Microsoft Exchange account!! Why is this so?

    Eversince installed Mountain Lion, i can't receive emails from my Microsoft Exchange account!!
    Why is this so? I don't have this problem prior to installing the Mountain Lion OS X

    Have you tried 10.8.1?  It includes fixes in this area.  Usually the problem is if Active Directory is returning incorrect Exchange information in response to an Autodiscover request.  In 10.8.1 you can manually edit this information.

Maybe you are looking for