How to make html + flash graphics? - html

I've seen many websites using flash to render their graphics using dynamic data.
How can I do this to put in a user account page, where it shows some dynamic data?

The most common ways of getting external data into a SWF are:
You can pass data to an embedded SWF using FlashVars
The SWF can load XML or JSON data by loading a file from the server (using a Loader)

Related

Trying to load local json file with createjs

I'm trying to load animations from Adobe Animate and it works fine when loading from a web server. But when loading from a local folder, I get "Access denied". The offending line is
loader.loadFile({ src: "images/1170_atlas_.json", type: "spritesheet", id: "1170_atlas_" }, true);
I should be able to simply include the contents of the file in a variable on the page and load the data directly. But I'm having problems finding the createjs function I need to call to load the spritesheet.Any ideas on how to do this?
You can not load JSON locally without doing some things like forcing Chrome to allow file access.
You can also get around it using JSONP, which loads the content as JavaScript.
If you want to manually load the contents, and embed your JSON in your page, you just have to make a new SpriteSheet manually. The EaselJS SpriteSheet docs have examples of this.
Cheers.

Downloading new SWF after passing in variables via FlashVars

I'm passing text to an SWF file via the FlashVars parameter in the HTML object. This is working fine and I can see the new text in my SWF in the browser.
What I'd like to be able to achieve now is for the user to be able to click a "Download" button which saves the SWF that's currently displaying the dynamic text.
Is the possible or is there an alternative way of passing text to an SWF via the browser and then saving that SWF with the next text "compiled" inside it.
Thanks,
An SWF is compiled code. Your FlashVars are runtime variables that are read into the compiled program. The short answer is, "No". What you're trying to do isn't possible. The SWF will always need to read into itself those variables, and storing them in the SWF isn't the way.
Because the SWF will need to load your data after it opens, the only question is "where to store them?"
If the data is specific to an individual's computer, try SharedObject.
If the data is general to all users, you could host the data on your site, and the app loads the file using URLLoader with XML/JSON/TXT.
If the data is dynamic for each user and needs to run offline, have your website write the XML/JSON/TXT and zip it and your SWF into a single download.

List all LocalConnection channels open in the page

Is it possible to list all channels initiated by LocalConnections from other SWF files?
I have an embed SWF file that creates a LocalConnection using a random number for the channel, and I would like to get connected to that channel, using another SWF I am building. However, I see no way I can connect to it, unless I know the channel's name.
Thank you.
No, unfortunately, it's not possible.
If your embed swf is AS3 based you can pass LC name to it when swf is loaded (or listen for the name in event from it, not difference), if it's AS2 the only way to pass variables is to load it with Loader by URL (not as embed bytes) and pass param via query, like "as2file.swf?lcname=_mylcname"

How can I control headers uploaded through a FileReference object?

I recently started using Flash Builder for the first time after developing C++ and C# for a long time.
I am using a FileReference object to upload a file to a server using its upload method. However, on the server-side, I need to receive a X-File-Name header. How can I control which headers are sent through the Flash object in Flex/ActionScript?
I couldn't find any resources about this anywhere. Is it possible?
I am afraid you cannot. The FileReference object is provided out—of—the—box and is not that much configurable.
But you can load the file, create your own sockets and reimplement the protocol with your needs (this is feasable if you don't need a lot of features).
Here is an example of how it works : http://googolflex.com/?p=367

Using external xml data in a Flex application without compiling the source into the application

I want to read xml data to a mxml application from a xml file on my filesystem. The example I found was for AIR,link2, link3. But I want to target the Flash Player runtime.
If I use the the tag, I can do it; however the xml compiles into my swf. How can I retain the xml file in my release build?
You can use UrlLoader to load the external xml at runtime. You may need to delay the loading of your app components until the xml has been loaded (depending on the details of your application.)
You need to use the mx:HTTPService tag , as referenced in the link you've provided