Can ActionScript be used to pass info to JavaScript?

Posted on 2004-10-29
Last Modified: 2010-04-03
I need a way of getting an often-changing 256 character string of data
into a JavaScript. Ordinarily (of course), I'd just put the string into a
separate, external file and call it in using <script src="256characterstring.js">.

Problem is, I'm prohibited from using iframes, javascript includes, etc.
But I can use Flash.

So my question is this... can the 256 character string be embedded
somehow into a flash file in such a way that it can be read and acted
upon by Javascript?

Knowing absolutely ZIP about ActionScript, it would seem like you could
create something and give it a title of "1234567890...." and then
using DOM inside of JavaScript get the title of that object.

If that makes ANY sense at all.. I appreciate your comments, feedback.

Question by:sleepybear
    LVL 1

    Accepted Solution

    There are a few different ways you could do this, here is a web site to look at for some examples:

    One easy way to do it is to create a text box on your flash file somewhere and call that variable value in javascript.  Here is the javascript code:

    Also, you can call a javascript function from flash
    Ex: getURL("javascript:parent.Main.Receive();","Main");

    If needed, you could pass values in the function call

    Hope this helps,
    LVL 6

    Expert Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
    While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
    The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
    The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

    913 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now