don't import a swf. load it.
if you're using as3, use the loader class. if you're using as2, use the movieclip loadMovie() method.
I apologize if I don't follow you directly as I am not sure what type of project to open to begin with to enable that. Flash Project or ActionScript 3.0? Once opened, what must I do from there? How am I able to use th Loader class you are talking about to reference back the external file on my hardrive since I don't want to import it? Thank you... Steven
the external swf won't be on your harddrive when you deploy your app, correct? most commonly it will be on a server in the same directory as the swf you're about to create. does that describe your setup?
Lets go with two setup configurations of where the swf file could be stored:
a) A more common situation will be for sponsors to give me the swf file. The file would be kept on the server's local harddrive. I assume the access could be either by direct file path on the hard drive (i.e drive c:/flash/my.swf) or through reference by the webservers URL/flash directory to serve the file.
b) Another possibility is that the swf file is on their systems and would need to access via URL.
At the moment, I have a sample .swf file on the local drive that was made by someone else to test with.
Looking in CS5, I have the stage open using a AS3.0 setup and was referencing Window->Code Snippets->Load and Unload->Click to Load / Unload SWF or Image, but it said I needed an object to select on stage (currently it is blank). Is there a way to select the stage itself as an object so I can assign the action to the stage to load in the SWF or must something else be done?
Thank you for any direction and advice you can provide. Have a fantastic day...
do you need to reference anything in the external swf or just display it with your transparent button on top?
Thanks for asking about this. No, I wouldn't have the need to access any information from within the SWF file itself. As you have correctly stated, it would be to just display a transparent button over top of the video so that when they click on the video area, I can route it to an appropriate URL.
Have a great day,
then it does't matter where the swf is stored as long as you know the url. if you're using as3, you could use:
var ldr:Loader=new Loader();
var yourbutton:Sprite=new Sprite();
Thank you for your tremendous insight and solutioning into what I need. Forgive me for being ignorant as I am so new to this tool and ActionScrpt. If I open up a AS3 project with a blank stage, what must I click or do to insert the code into the appropriate section to see the demonstration of your solution? Do I need to create a class file to use this or is there existing section of code that I can use to cut and paste this into ? Once I know how to implement this in the tool, then I should be good to go.
In my attempt to find some reference information, would I do the following?:
1) Open new AS3 Project
2) With a blank stage opened.
3) Create a new layer called "Action"
4) Click on Frame 1 of the "Action" Layer
5) Hit F9
6) Copy and Insert Code
7) Goto last Fame of the "Action" Layer
8) Hit F5
Would these be the correct steps to implement the code above?
Thank you very much!
shortcut keys are customizable:
do the following:
1) Open new AS3 Project
2) With a blank stage opened.
3) Rename the only layer "Action"
4) Open actions panel (window/actions)
5) Click on Frame 1 of the "Action" Layer
6) Copy and Insert Code into actions panel7) Save (file/save as)
8) Publish (file/publish)
9) upload to a server and test.
I tried implementing the code script above. For some reason, the .swf file is not being displayed. I happened to click up in the area of the screen (since the rectangle was white) and it did redirect to the website.
Here is the original .swf file that I found off the Internet that I am testing against:
(or visit here for more---> http://www.brainybetty.com/free_swish.htm)
I have the file on my local system which I tested to make sure the webserver will serve up - and does work. But when I repackage and deploy into a new .swf file, the video is not appearing. Any ideas?
To make sure the .swf file that I created is working, I changed the dimensions of the rectangle and made it a blue color. Which was visibile and could then redirect to the webpage.
I am just not sure why the Loader is not displaying the dotcube.swf animation. As another test, I even commented out the rectangle code, leaving only the Loader and all I had was a blank screen when I redeployed.
what's the url to your embedding html?
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="640" height="480">
<param name="movie" value="http://192.168.1.106:8080/test/content/redirect.swf" />
<param name="quality" value="high" />
<embed src="http://192.168.1.106:8080/test/content/redirect.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="640" height="480"></embed>
The Redirect.swf should be importing the dotcube.swf and adding the rectangle URL redirect.
The action script portion is set to load the dotcube.swf file which is accessible if I open a browser and call that URL - it displays directly.
I am currently on a Windows platform and did make sure that the .swf file is unblocked for Internet. Here is the screenshot showing below that the dotcube.swf loads up just fine through the webserver. So the access and permissions should be okay for that file.
I am able to also demonstrate that my new Redirect.swf is able to load and be served up by the webserver as it will redirect (with a transparent/invisible rectangle), but cannot display the dotcube.swf as shown above. Any possible ideas as to why the Loader is not able to display it?
Does that help?
what's the url?
The server is not directly on the internet yet, so its not registered in the DNS or associated domain name. The equivalent for me to access within my local network is by using the server's IP address (i.e. http://192.168.1.106:8080)
As shown, I can call the dotcube.swf directly through the webserver @ http://192.168.1.106:8080. When I post the URL inside of the Action Script, I should have access to load that file into my Redirect.swf.
Are you able to take the original file @ http://www.brainybetty.com/FlashandSWish/FLash/dotcube.swf and see if the Action Script example works for you?
Out of curiosity, I made a quick sample .swf of my own and deployed to the server which interfaced with a java servlet. The solution you provided works. I then tested on another .swf on another website where the file doesn't reside on my server and it worked as well. I concluded that the original file I was trying to work with was either part of some sort of conversion (from a swish to swf?) or was an older version of some sort - pure speculation, but I do know that file would not work, but the others do.
The transparent rectangle works great to redirect once clicked. I will mark one of your previous responses as the correct solution.
Thank you for your help and assistance,