External swf troubles
Here's the skinny. I created a VERY simple site, main page,
one button, and a second page with samples. Each sample is an
external .swf with a fade in and fade out for nice transitions
between each sample.
If I go to the samples page and click on a number the
external .swf loads fine for each, but if I click 'home' then try
the same process there is a failure and no external .swf's will
load.
Once I leave the samples page I cant go back without it
failing.
Im sure its something simple, but does anybody have any
suggestions?
Here's my code for loading the external .swf for each sample:
stop();
one.onRollOver = over;
one.onRollOut = out;
one.onRelease = goone;
function over () {
this.gotoAndPlay(2);
function out () {
this.gotoAndPlay(7);
function goone () {
if (_root.currMovie == undefined) {
_root.currMovie = "sampleone";
container.loadMovie("sampleone.swf");
} else if (_root.currMovie != "sampleone") {
if (container._currentframe >= container.midframe) {
_root.currMovie = "sampleone";
container.play();
Thank you to anyone that can help!
My main page has one button on it. 'photo retouching' . When
clicked it takes you to a new frame that has 6 buttons on it, 1
through 6. there is a blank mc in the upper left corner that is
used as a container. when you click a button it loads the external
swf, when you click a new button the current sample fades out, and
a new one fades in. below there is a home button. if i click that I
go back to the main page with the 'photo retouching' button on it.
if i click that, regardless of what sample was the last to be
viewed, it takes me to the samples page with a blank mc used as a
container and 6 working buttons.
so the jump from frame to frame is fine, but Is the last
viewed sample supposed to stay loaded?
(the container is only located on the single frame of my
timeline that holds the samples page, does that matter at
all?)
Similar Messages
-
Trouble Opening External .swf
on(release){
gotoAndStop("Architecture");
myMC.loadMovie("ARCH_GALLERY.swf");
Hi, I am making a website for myself and right now I am having trouble opening an external .swf file.
I already made my external gallery that I am using (ARCH_GALLERY) and I am trying to allow it to open
inside a movie clip which is on one of my pages. The code I posted above is on the button which accesses
this movie clip to start my portfolio page (Architecture). When I test it or publish it the external will not play
and I am not getting any error messages.
I am new to flash so I may not be doing it correctly. Inside my movie clip page "Architecture" I have another
movie clip as a placeholder for the external .swf (myMC). Then I put the code to open the external .swf on
my button Architecture. Thank you in advance for your help.If that code is executing in a frame where that myMC does not exist, then it cannot work. That movieclip needs to be present. AS2 is not very generous with error messages. If you have the chance to, start by learning AS3 instead of AS2... it is more generous with error messages and better to learn in the long run.
If you are just learning Flash, break away from learning bad practices... stop putting code on objects. Instead of that place your code in the timeline. Give that button an instance name (ex: btn), and in the timeline trhat holds it place code like the following...
btn.onRelease = function(){
gotoAndStop("Architecture");
myMC.loadMovie("ARCH_GALLERY.swf"); -
Trouble loading external .SWF into my main page with preloaders
Dear All,
I am working on my first Flash project with AS3.
The structure of the flash site is pretty simple. I have a
stage 1165px wide x 710px height
Inside my Stage I have an horizontal bar with a menu followed
by a container right under.
**** My goal
is that whenever I click on one of the button on the menu, that the
related external .SWF loads into
the container with a preloading bar and %. *****
I already did all my .SWF files and it is pretty frustrating
at this point to be stuck at this point of development.
Please help.
-AlexVisit gotoandlearn.com. There is a video tutorial there
regarding preloading that should answer most, if not all, of your
wonderings. -
Trouble loading an external swf file implemented with AS3
I am using Adobe Flash CS3
At first, I tried
swf_mc.loadMovie("//swf file
location");
It gave me
quote:
Warning: 1060: Migration issue: The method loadMovie is no
longer supported.
USE: var l = new Loader(); addChild(l); l.load(new
URLRequest("your url"));.
Well, the given code isn't working at all.
But since it is a migration error, I thought maybe I can just
save it into Flash5 format with AS1. Then it worked with most
external swf files. However, the one I am trying to load is a swf
file with AS3, so my older version swf can't load it at all.
Anyone has any ideas about how to load an external AS3 swf
file?AS3 is a completely different beast than AS1 or 2. loadMovie
was removed from the language.
The answer to your question is two fold. First, Adobe was
kind enough to give us the code when it finds a migration issue.
var _ldr:Loader = new Loader();
addChild( _ldr );
_ldr.load( new URLRequest( "your url") );
Handling progress has also changed. I have a ContentLoader
package on my site that you're free to use that should familiarize
you with the new way that things are done in AS3.
http://sd-dezign.com/blog/?page_id=10 -
Trouble unloading external swf's
Hey, so firstly, I am completely new to Flash and know absolutely nothing :| But heres my problem:
In one particular keyframe, I have five buttons on the left hand side of my stage, that when clicked, display an external swf on the right handside. It works perfect fine using the code below. However on this frame where all this is going on, I also have a back button that i want to link back to the home page. But I just CAN'T seem to get it to unload the external swfs as well as go back in the timeline Any assistance would be great! Cheers
var Xpos:Number = 675;
var Ypos:Number = 225;
var swf:MovieClip;
var loader:Loader = new Loader();
var defaultSWF:URLRequest = new URLRequest("swfs/pacman1000.swf");
loader.load(defaultSWF);
loader.x = Xpos;
loader.y = Ypos;
loader.scaleX = 0.8;
loader.scaleY = 0.8;
addChild(loader);
// Btns Universal function
function btnClick(event:MouseEvent):void {
removeChild(loader);
var newSWFRequest:URLRequest = new URLRequest("swfs/" + event.target.name + ".swf");
loader.load(newSWFRequest);
loader.x = 690;
loader.y = 275;
loader.scaleX = 0.8;
loader.scaleY = 0.8;
addChild(loader);
// Btn listeners
pacman1000.addEventListener(MouseEvent.CLICK, btnClick);
snake.addEventListener(MouseEvent.CLICK, btnClick);
tetris.addEventListener(MouseEvent.CLICK, btnClick);
spaceinvaders.addEventListener(MouseEvent.CLICK, btnClick);
simon.addEventListener(MouseEvent.CLICK, btnClick);Oops sorry I forgot to put "function"!
function onBackButtonClick(e:MouseEvent):void {
Obviously your back button needs an event listener to call this function.
Kenneth Kawamoto
http://www.materiaprima.co.uk/ -
Trouble figuring out pathname for embedded swf loading external swfs & xml
I have a swf that loads content from an XML file. This works fine when everything is in the same directory, but I want this swf to appear in several different HTML pages, which are in several different directories and I don't want to have to put 8 different copies of my swf online just so that they load properly. The directory structure is like this:
main_dir:
mod_dirmod01_dirmodcontent_dirmyembeddedswf.html
myflash_dirsub1
sub2:
myflash.swf
myflash.fla (not uploaded to the server)
xml_dir:myxml.xml
I created "sub1" and "sub2" just so that my swf would be the same number of directories downwards as the html has to link upwards, so that when I test the source file, it works. For the HTML, it's embedded like this (using swfobject):
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="800" height="500" id="../../../myflash_dir/sub1/sub2/myflash">
<param name="movie" value="../../../myflash_dir/sub1/sub2/myflash.swf" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="../../../myflash_dir/sub1/sub2/myflash.swf" width="800" height="500">
<!--<![endif]-->
<div>
<p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
</div>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
And inside the Actionscript, I have a URL like this to load the XML:
../../../myflash_dir/sub1/sub2/xml_dir/myxml.xml
Testing the .fla works. But the swf does not work in the HTML. myflash.swf loads, but the loading animation spins and spins, so presumably myxml.xml is not loading. Can anyone see what I'm doing wrong?Durrr, this is not the first time I've answered my own question. Maybe something about trying to explain it to someone else lets my brain make the critical connection.
Anyway, yes it was everything to do with the external SWFs being loaded. My main swf actually loads an xml containing URLs from which to load all of the other SWFs and so I had to update the URLs inside of that, and that fixed the problem.
Sorry for wasting forum space, but maybe this will help someone else out! -
Having trouble loading an external swf (loadmovie?)
Hello!
This is my first time ever constructing a web site ONLY using Flash 8. I normally just use elements here and there, and I am totally confused.
The link to the project is here: www.cathisingh.com/new
I want the site to be set up so that when I click a button (at the bottom), an external .swf file loads into that gray box in the center. How do I start? Where do I start? I should be able to figure this out, but I am stuck.
Thanks for the help!Hey!
You can use a script like this to load a swf.
BUTTON.addEventListener(MouseEvent.MOUSE_UP, LoadExternalSwf)
function LoadExternalSwf (e:Event) {
var request:URLRequest = new URLRequest("/media/EXTERNALSWF.swf");
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(flash.events.Event.COMPLETE, Finish);
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, status);
loader.load(request);
function Finish(e:Event) {
externalMovie = MovieClip(loader.content);
NameOfYourGreyBox.addChild(externalMovie);
function status(e:ProgressEvent) {
var percentage:Number = Math.round(e.bytesLoaded/e.bytesTotal*100);
progressBar.gotoAndStop(percentage);
This creates an event listener on your button (BUTTON) so that when someone clicks it, the function LoadExternalSwf is run. That function creates a URLRequest for the file at your URL, loads it, and then adds it to your grey box (which i assume is a movieclip). I included a progress bar function, which creates a variable called percentage that varies from 1 to a 100 and manipulates a progress bar movieclip that has a 100 frames (a bar going from empty to full).
Let me know if you need anything else.
I really like your site. It looks great.
John -
Urgent! external swf not loading with swfobject!
hello there,
I have a swf that loads another one into it through an empty
movieclip - When i embed it with swfobject it doesnt appear.
My guess is that i would have to mention the external swf in
the flashvars ... Done that with no success.
Does anyone have an idea of what could be causing me this
trouble?
thanksGenerally the problem will be that the path of all externally
loaded content is relative to the html page, NOT the swf location.
If everything is in the same folder then that isn't it.
Otherwise nice dice is correct, we will need to see your code
to go further. -
External .swf not loading on HTML pages
Good morning,
I'm having trouble and I was hoping someone could shed some light on what I'm doing wrong. I have a main .swf file from which external .swf files are being loaded through the use of buttons.
When I preview the animation, everything works just fine. The problem occurs when I put the animation on the website where it needs to be. The main animation appears like it's supposed to, but the buttons are not successful in loading the external .swf files. I've made sure that all .swf files are on the server but still nothing. Could anyone help? I'm not sure what the problem is.
Here's the AS:
stop();
var presentationLoader:Loader = new Loader();
addChild(presentationLoader);
//Navigation
presentation1.addEventListener(MouseEvent.CLICK, buttonClick);
presentation2.addEventListener(MouseEvent.CLICK, buttonClick);
presentation3.addEventListener(MouseEvent.CLICK, buttonClick);
presentation4.addEventListener(MouseEvent.CLICK, buttonClick);
presentation5.addEventListener(MouseEvent.CLICK, buttonClick);
presentation6.addEventListener(MouseEvent.CLICK, buttonClick);
function buttonClick(event:MouseEvent):void
presentationLoader.load(new URLRequest(event.target.name + ".swf"));
function homeClick(event:MouseEvent):void
presentationLoader.unload();
Thank you,
- CmarcouxFor anyone having a similar problem in the future, the solution is in bold:
stop();
var presentationLoader:Loader = new Loader();
addChild(presentationLoader);
//Navigation
presentation1.addEventListener(MouseEvent.CLICK, buttonClick);
presentation2.addEventListener(MouseEvent.CLICK, buttonClick);
presentation3.addEventListener(MouseEvent.CLICK, buttonClick);
presentation4.addEventListener(MouseEvent.CLICK, buttonClick);
presentation5.addEventListener(MouseEvent.CLICK, buttonClick);
presentation6.addEventListener(MouseEvent.CLICK, buttonClick);
function buttonClick(event:MouseEvent):void
presentationLoader.load(new URLRequest("../../media/flash/" + event.target.name + ".swf"));
function homeClick(event:MouseEvent):void
presentationLoader.unload();
For the animation to work on a website, the file path was needed. -
Unloading a loaded external SWF with a close button on the external SWF to unload
I have found some discussion on this topic but I am still having trouble getting it to work and was hoping to get some help here.
Here I have a file: http://www.dril-quip.com/test/main.swf
I have: main.swf (a menu) and I have module.swf (content)
If you navigate to Subsea Wellhead Systems/SS-15 BigBore II and click on that I have it load an external swf which covers most of the parent.
So far so good. My problem is unloading the loaded 'Child' swf with the button provided on the loaded 'Child' swf.
below is the code I used to load the file but I cant, for the life of me, find a way to unload it.
var bigboreLoader:Loader = new Loader();
btnbb2.addEventListener(MouseEvent.MOUSE_UP, bigborecontent);
function bigborecontent(event:MouseEvent):void{
var bigboreRequest:URLRequest = new URLRequest("moduletemplate.swf");
bigboreLoader.load(bigboreRequest);
stage.addChild(bigboreLoader);
I am certain it requires the Child to communicate with the parent somehow but I am at a loss. If I could get a bit of advice or a link to something deal with this, it would be a big help. I just need to have my links load my modules and the remove them when the close buttong is hit on the loaded swf. I promise I have done searches and I admit I have found asnwers but still they are not working. I found the code below:
Main FLA:
function removeF() {
removeChild(bigboreLoader);
var bigboreLoader:Loader = new Loader();
btnbb2.addEventListener(MouseEvent.MOUSE_UP, bigborecontent);
function bigborecontent(event:MouseEvent):void{
var bigboreRequest:URLRequest = new URLRequest("moduletemplate.swf");
bigboreLoader.load(bigboreRequest);
stage.addChild(bigboreLoader);
EXTERNAL FLA:
btnClose2.addEventListener(MouseEvent.CLICK, bigborecontent);
function bigborecontent(myevent:MouseEvent):void {
MovieClip(parent.parent).removeF();
I think I have a misunderstanding of the code. Thanks for any help you might be able to provide.This was the original code I got:
Main FLA: (on AS layer inside DropDownButton Movie Object)
function removeF() {
removeChild(myLoader);
var myLoader:Loader=new Loader ();
page1_mc.addEventListener(MouseEvent.CLICK, page1content);
function page1content(myevent:MouseEvent):void {
var myURL:URLRequest=new URLRequest("page1.swf");
myLoader.load(myURL);
addChild(myLoader);
EXTERNAL FLA: (on main time line of this file)
close_mc.addEventListener(MouseEvent.CLICK, closeMC);
function closeMC(myevent:MouseEvent):void {
MovieClip(parent.parent).removeF();
Main.FLA
myLoader=bigboreLoader (my new loader)
page1_mc=btnbb2 (the button who event will call external swf)
page1content = bigborecontent (name given to SWF being loaded???)
myURL=bigboreRequest (my new URLrequest for bigbore)
page1.swf=moduletemplate.swf (actual address of what I am loading)
External.FLA
close_mc=button that will close external swf
closeMC=movie clip to close? -
How to detect the end of an external swf loaded into a container
Hi,
I'm having trouble finding a solution for this problem, can somebody help me?
I have a main swf that will load external swfs into a container. I need to detect the end of the loaded external swf in order to start to load and play a new one into the same container.
The problem is that i do not know what the length of the external swfs will be, and will have no control over the development of them, so i cannot place a variable at the end of their animation which would allow me to detect from the main movie its end.
I also cannot rely on the _totalFrames property because the loaded swf might not have all the animation inside its main timeline.
Is there any way to achieve this goal?
ThxOk... Its as i thought... unfortunatly...
Gonna mark your latest post again as possible solution, just in case someone comes with any sort of out of the box thing...
Thx for your help Kglad -
I'm having an as2 issue loading external swfs
I have external swfs loading into a main swf, and the
different subpages in the same fla but encapsualted within
movieclips and each movieclip is on a different layer in the
timeline. The trouble is that I can't disable the buttons on the
different layers so if a particular page loads all the hit states
are still on the stage even though I cant see the actual button.
This is the code I think needs to be changed I tried modifying the
for loop, but I don't know how to go about disabling those
hitstates Ex. I'm on the contact page but hit states from the home
page are causing the mouse icon to chnge when rolled over. I added
this to the for loop but it just broke the swf:
else if (id = "home")
_root.mcPages.mcSection1.home._visible = false;
I think since its externally loading I need to use relative
targeting or use _level?? instead of _rootYou may want to check this thread:
https://discussions.apple.com/message/17411662#17411662
and maybe search out the OP and ask him. -
Drag & Drop Functionality Doesn't Work in External SWF?
Hi all,
I'm currently a TA for a Flash course at my school. We're using AS 2.0 and working with external SWFs.
I think this might be pretty simple to remedy. Well, at least I'm hoping!
A student is having trouble with drag & drop functionality when it is used in an external SWF. Basically, in our drag & drop section, we have a sheet of paper ("paper" MC) and an object we drag into it ("object" MC). When the object is released in the paper area, we go to frame 2 of "paper" MC, which consequently has an animation.
This works fine and dandy in said drag & drop section, but once the drag & drop section is loaded into our main SWF via a MC placeholder, the drag & drop functionality stops working.
Here is the URL to the drag & drop section by itself:
http://www.phayzed.com/flashkit/drag_for_animation.swf
and here is the URL to the main swf, which loads the drag & drop SWF into a movieclip and causes it to work incorrectly:
http://www.phayzed.com/flashkit/main.swf
Now here is the code on the draggable object ("object" MC):
on (press) {
startDrag (this, true);
on (release) {
stopDrag ();
if (this._droptarget == "/paper") {
_parent.paper.gotoAndStop(2);
_parent.object._visible=false;
If any more info is needed, I'm willing to upload both FLA files. Although, something tells me that this is a simple issue to resolve.
Thanks a lot for any help!!!
Cheers
Twith as2 you must convert that antiquated as1 code:
on (press) {
startDrag (this, true);
on (release) {
stopDrag ();
if (eval(this._droptarget) == _parent.paper) {
_parent.paper.gotoAndStop(2);
_parent.object._visible=false; -
External SWF controlling main timeline
Hi all --
I have a main SWF file that I am loading a smaller, external
SWF file into (with loadMovie, if you care to know). Within that
smaller file, I have a button -- ideally, this button should
trigger an action within the main SWF file.
My problem is that I cannot get the external SWF file to
control an action within the main SWF. I'm guessing there must be a
way to do this, but I'm having some trouble here.
Thanks in advance... please advise!Well.... there may be a reason if it is set up correctly and
still doesn't work....
Is this external SWF hosted on another server?
If so, you might be running into crossdomain policy problems.
I've had the issue that remotely-hosted SWFs will not OBEY commands
from the root timeline while they are remote, but work just fine
when they are copied onto the same server as the main SWF.
Do a search on crossdomain policy XML in Flash help. It may
help you get around this problem. -
External .swf Loading?
Hello.
I am having trouble making a button load an external .swf file!!!
I have a made a flash file, and in the navigation; once a Button is pressed it should load another .swf file but I can't get the Button to load another .swf despite numerous attempts, and Google searches!!
Can someone please tell me how to do?? :-o
Make a Button load an external .swf file once pressed!!?
I'm trying to do this in AS2!
Thanks so much!in your event handler you will want code that looks like
loadMovie("circle.swf", mySquare);
mySquare is defined earlier as a movie clip. You can see the information about loadMovie here
Maybe you are looking for
-
The time machine Icon does not does not show up in my menu bar
The time machine icon does not appear in my menu bar. The desk top icon for the external hard drive is green. I've checked preferances and the time machine is turned on and the box is checked that has the icon appear in my menu. I've turned off the t
-
Tags are not found when typing a keyword into the location bar
Previously when I typed a tag into the address bar - tagged bookmarks would show up. Now very rarely does this happen and instead search engine search terms show up. To search for tags/keywords I now have to open the bookmarks and do a search in ther
-
Mac mini crashing when booting up
Hi, does anyone know why the mac mini crashes at bootup. it gets teh strart up ping, then the loading screen, then the harddrive turns off. any ideas why this is happening
-
Hi SAP Gurus, Please help me to solve my below problem: Invoice 562356891 created first, found all the values are correct. But when created the excise invoice 2315648975 dt.21st Apr '09 found the basic excise duty, cess and s.cess was calculated wron
-
Error during activation in Text Elements
Hi All, I am getting ' Error during activation ' in Text Symbol While Creating new transport request. and in Changing mode it's shows inactive mode For Previous Transport request user. Please Suggest any Solution For that . Thanks & Regards, Manish