I have a flash banner ad (AS3) which uses a FLV Player component for a remove video. The Skin exports it's own SWF file for user with the video controls as I'm sure anyone familiar with Flash knows.
Is there anyway to specify where this file is remotely? I have to provide 1 file to my advertiser, and do not want to have to create custom video controls for this. Is it possible to upload this swf file to a remote location and tell Flash to pull it from there?
Any help would be greatly appreciated.
if you're using the actual FLV component, you would use the skin property
A string that specifies the URL to a skin SWF file. This string could contain a file name, a relative path such as Skins/MySkin.swf, or an absolute URL such as http://somedomain.com/MySkin.swf.
e.g.
vidPlayer.skin = "http://youdomain.com/skin.swf";
If you're going to go that route, you need to setup a crossdomain.xml file on that server that is hosting the skin so whoever is making the request to load the skin swf is allowed.
I did banner creations for a little while and I remember the strict file size limits and the one file thing. I ended up hosting a lot of the content on remote servers too.
Related
I created a game in as3 in FlashDevelop IDE. I have my own webspace, but I'm a rookie in the sense I've never put a game on it before. I currently have a .as3proj file and a bunch of .as and .png files. What steps would I take here? I know it will involve embedding it in html, but I have no idea what to embed or how/what that entails.
When you compile your project in Flash Develop, you have a bin folder containing a html file and a swf file. You need to transfert the content of the bin folder and every assets loaded at runtime (images, xml, mp3, ... ).
Can you post your directory structure for more help?
At the bare minimum, there should be a swf file in there that you need to deploy. This is the equivalent of an exe. Do not deploy .as files, as3proj files, or anything else like that. As for pngs, only do so if you do not have them embedded directly into the swf (this would at least generally involve the Embed tag being placed above non-local variable declarations). Make sure the path the swf is using to access the pngs, mp3s, and whatever else will still be valid once you deploy it and those files.
If you use code like:
[Embed(source = "plane.png")]
private const PLAYER:Class;
for every picture, you're embedding them, so you don't need to deploy them. If you weren't embedding them though, you'd just be linking to them. If you're linking over the Internet, just use a public URL to access those pngs, not a private, internal IP or localhost or anything like that. If you own the pngs and can copy them onsite, you would probably want to use a relative path. If the path to your pngs when running out of your IDE is assets/images/<png file>, go ahead and use that relative path, then wherever your swf is located on the server, make sure the pngs are in <swf's folder>/assets/images.
You do not necessarily have to embed the swf; it can act as its own webpage. This is not smart though, in many situations. The main reason is cache-busting. Also you may wish to use JavaScript to do things like detect whether the person has an enabled, valid Flash Player.
There are two open-source js files that help with embedding your swf: AC_OETags.js and functions.js. Use them. As a matter of fact, I believe Flex/Flash builder will build an HTML or ASP file that embeds the swf, with the help of these files. Just remember to put cache-busting meta tags into that file, so that you can immediately change the swf later.
Users upload images and select a template AS3 file, which would be used together with the images to compile into a SWF and be downloaded by the user.
Basically, use my own custom animations with the user's resource files in order to compile a new SWF at run-time.
I found a tool called "swftools", which can convert images into a slideshow, so I know something like this is partly feasible, I just don't know enough about AS3 to know how to load resources dynamically, without creating a FLA file manually.
EDIT: To clarify, I do not want to dynamically load an image from a URL or file at run-time. I want to embed the image into the SWF, but the image data is decided at compile-time.
Same problem here, and I found some great tuts that show how it's done, but (unfortunately) in AS2 (not AS3):
loading images
The code to convert:
loadMovie("photo.jpeg",photo.empty);
loading text
The code to convert:
myData = new LoadVars();
myData.onLoad = function () {
myText_txt.text = this.myVariable;
};
myData.load("myText1.txt");
AS2 to AS3 is very poorly documented, even for small scripts…
If you have a solution I'd like to know it ;-)
Use Flex and compc compiler.
http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7fd2.html
You can modify as3 sources on server and embed your images with [Embed(source='path/file.ext')] directive, run compc and get final swf...
I am loading an external .jpg file into flash through AS3.0 with Loader class and later I need to save the image file into .doc with FileReference Class... Is it possible?
Please Help me...
Thanks a ton..
Wow... this is a good question! Yes this is possible, but not all through Flash.
REQUIRED: Flash / PHP
How to (I'll add full examples later):
(1) create a php page that will accept the raw post output
(2) set the headers on the php page to match a .doc file
(3) send the image data from Flash to PHP, have php serve the .doc file back
What this will do is allow the user to send/save the image in Flash, and have a download context box popup to save the .doc file.
I have a .swf file inside a website I've been asked to modify. Will this file contain normal html files and if so how do I get to them, there are no .fla file on the machine that created the site.
Thanks
Ross
.swf file is a flash element which is "playable" by your flash player. .swf is normally created used action script. In other words, the .swf file is the compiled version of the .fla file, and you can therefore not edit the .swf file.
Although Roskvist is completely right, there IS a way to convert .swf files back to actionscript code (and possibly .fla). This won't get you the original source code, but an 'estimated' code (with different variable names etc) that would give you pretty much the same .swf upon rendering. This can be done by software called a 'flash decompiler'.
A word of warning though: It's not okay to use this for stealing flash code from others' flash creations, you must have the rights to use any source code.
I have a folder "/assets/animations" filled with .swf files. I would like my AS3 script to embed all these assets so they can be later called to play or stop.
I hear a lot about the Loader class but it looks like it doesn't embed all the files at compile time but rather grab them from a url when needed.
Basically these assets are cut scenes for a flash game. I would like all of them to be present in one final .swf so its easy to play on any machine without an internet connection.
[Embed(source="scene1.swf", symbol="scene1ID")]
public var Scene1:Class;
private var scene1:MovieClip = new Scene1();
scene1.play();
This should help you...
http://www.bit-101.com/blog/?p=853
no, you cannot dynamically use the embed metadata command.
it's actually more like an inline compiler argument than actual as3 code.
so no, you can not use variables the embed command.