Problem Loading swf with MCL class
Hey, I am relatively new to actionscripting and am having a
bear of a time trying to figure out why this won't
load.....basically i am trying to use the movieClipLoader class to
call up a swf..... so basic i know..This is my script
any help here?
does container exit on the timeline that contains your code?
is master.swf in the same directory with your flash swf and
html?
Similar Messages
-
Loading SWF with audio playing in it...
I was loading a SWF file, and noticed that even if I didn't
add it to the display via addChild() that I can hear the audio
playing in it. Why is this? And likewise, when I do addChild(), and
see the SWF, then later use removeChild(), and no longer see it, I
can still hear it playing.
I can sort of understand that even though it's not displayed
until using addChild() that one would HEAR it, because it is loaded
- correct? But how would I actually get rid of/delete this when I
no longer want to see/hear it ?Thanks to the both of you! I'd like to see the things you do
to "close up shop" on the loaded SWF.
I also found something about getting access to your loaded
SWF here:
TextAccessing
document class of an externally loaded swf with AS3
That blog describes adding a generic object in the complete
listener:
var loaderInfo:LoaderInfo = e.target as LoaderInfo;
var myLoadedSWF:Object = loaderInfo.content;
You can then target myLoadedSWF and access your SWF. Seems
pretty different than AS1 & 2, but I suppose that's how it is
(unless there are better ways). -
I.E./Active X problem loading movie with multiple .swf
I have a webpage that loads .swf's into a main "container"
swf, and I've found a fix for the I.E./Active X (this is a good
bookmark:
http://www.kirupa.com/developer/flash8/flash_fix.htm
). But the container seems to get stuck on the preloader now? Any
ideas?
PROBLEM PAGE HERE
WORKING PAGE HEREFRAME 1:
System.useCodepage = true;
main="";
pageNum=1;
if (_framesloaded > 50){
//if (_framesloaded == _totalframes){
gotoAndStop (8);
} else {
gotoAndPlay(1);
FRAME 7:
gotoAndPlay(1);
FRAME 8:
if (whichFrame == "return"){
gotoAndStop (20);
less6.gotoAndStop(2);
} else {
gotoAndStop("splash");
FRAME 20:
if (_framesloaded == _totalframes){
gotoAndStop ("p14");
} else {
gotoAndPlay(10);
} -
(MX04) Pausing a loaded swf with sound objects within it
Hi,
I'm working on a PowerPoint-esque presentation where a user
watches and listens to a loaded swf in the main movie, clicks the
next button (which unloads the swf, advances to the next frame and
loads the next swf), and watches the next one. Lather, rinse,
repeat. Some of the sections are rather long, and I'd like to give
the user the ability to pause and play by button click.
I know how to stop and start the container MC, but that
doesn't stop the sound object (and the embedded MCs). I also know
how to pause and start a sound object using the object's instance
name. Is there a way to pause everything from the main timeline,
and keep the AS general enough so that any sound object pauses when
clicked?
Any help is most appreciated! MX04 and AS2.0.
Thanks!Kglad,
I tried your code and ran into some problems with stopping
the mc's, as the embedded mc's within the loaded swf need to stop
as well. I found the attached code to stop the mc's, but now am
having trouble with the sound objects.
Here's the issue, I used this:
this.soundPosition = currentMovie.loop1.position/1000;
this.currentMovie.loop1.stop();
... for the sound object stop commands and listed a new one
for each loop I was using. On the play button I started them back
up again. This all works, but when I start them up again they all
play, not just the one that is currently paused. Do you mind giving
me some guidance with the for (obj in mc) loop? My loop experience
is nil. What I want to do is have the code cycle through all of the
loops to see which one is playing, then store that information in a
variable, then pause and play the variable. Does that sound right?
Thanks again for the help!
-Sandy -
DMP 4310 load swf with flashvars
Hi,
I am using dmp 4310 and i want to load a swf file using flashvars. This swf is loaded through another swf (a wrapper swf) with the "MovieClip Loader Object" (AS2). When i load the swf using http request i do not have any prblems (eg clipLoader.loadMovie("http://10.0.0.1/swfTest.swf?flashVar1=test1")). The problem is that i cannot get the flashvars by loading the same swf file locally (eg clipLoader.loadMovie("file:///tmp/ftproot/usb_1/files/swfTest.swf?flashVar1=test1")). Is there any way to get the flashvar? Also, is there any way to access the swf file (with the flashvars) using the internal http service (eg http://localhost/...swfTest.swf?flasvar1=test1 -- where localhost is the player itself).
Thank you in advance for your response!Suddenly that code in the following gives me some error
var langPath = root.LoaderInfo.parameters["xmlFilePath"]+root.LoaderInfo.parameters["lang"];
my_ssp.xmlFilePath = langPath;
var fileType = root.LoaderInfo.parameters["xmlFileType"];
my_ssp.xmlFileType = fileType;
Access of possibly undefined property LoaderInfo through a reference with static type flash.display:DisplayObject.
The only code snippet works is
var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
for (var param in paramObj) {
if (param == "xmlFilePath") {
my_ssp.xmlFilePath = paramObj[param];
if (param == "xmlFileType") {
my_ssp.xmlFileType = paramObj[param]; -
Controling a loaded swf with another loaded swf
I have a blank stage with only AS that loads an swf
addChildAt(0) and a second one addChildAt(1). This works. When the
user interacts with (1) it calls another addChild (not indexed) and
possibly that one loads another, depending on the choices made by
the user. How can I get any of these to control that very first
child that was loaded at (0)? I have run out of ideas.
Some of the code:
(on the main swf, nothing on the stage, only code that loads
the next two)
addChildAt(pHolder, 0);
pLoader.load(pURLReq);
pLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
pLoaded);
and for the second:
addChildAt(mHolder, 1);
mLoader.load(mURLReq);
mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
mLoaded);
On the child of childAt(1), I have:
function replaceSWF(e:MouseEvent):void
pLoader = new Loader();
pLoader.load(new URLRequest("p.swf"));
pLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
placeNewClip);
function placeNewClip(e:Event):void
removeChildAt(0);
addChildAt(e.target.content, 0);
If I use this exact same code from that very first swf, the
one that loads the first two external swfs, it works, but once I
put it on one of hte other loadeds and sub loaded swfs, I can't get
it to work. In the current state (0) it just makes everything on
the stage disappear, so I figured then using the index of (1) would
do it, but that or any other number results in absoluly nothing.
Help! I am really out of ideas here.
(the stacking looks like this) ---
sub second loaded SWF <==== needs to tell first loaded SWF
to unload then load a new swf at same index
second loaded SWF <==== loads the next one above
first loaded SWF <=== needs to be removed and another swf
loaded at the same index
mainSWF (loads two others) <=== code placed here works for
first loaded SWFKglad,
I tried your code and ran into some problems with stopping
the mc's, as the embedded mc's within the loaded swf need to stop
as well. I found the attached code to stop the mc's, but now am
having trouble with the sound objects.
Here's the issue, I used this:
this.soundPosition = currentMovie.loop1.position/1000;
this.currentMovie.loop1.stop();
... for the sound object stop commands and listed a new one
for each loop I was using. On the play button I started them back
up again. This all works, but when I start them up again they all
play, not just the one that is currently paused. Do you mind giving
me some guidance with the for (obj in mc) loop? My loop experience
is nil. What I want to do is have the code cycle through all of the
loops to see which one is playing, then store that information in a
variable, then pause and play the variable. Does that sound right?
Thanks again for the help!
-Sandy -
Load SWF with instances into MC
Hello,
I have a SWF called "player.swf", and it contains instances
like: "head", "body" etc...
I want to load that SWF into another SWF
("display_player.swf"), and to load ANOTHER SWF to replace the
"head" instance, like:
"_root.p" is a transparent red colored movie clip inside
"display_player.swf"
I tried doing this:
_root.p.loadMovie("player.swf");
trace(_root.p.head);
"_root.p" said to be "_level0.p" and is displayed correctly,
but "_root.p.head" said to be undefined (NaN)...
Does anyone has an idea on how to load a SWF inside a movie
clip, and use it's instances?The point here is to demostrate, or at least determine, what
the problem is. I have stated that it is probably likely that you
are making the call to _root.p.head previous to it being
instatiated on the timeline. you must wait for the swf to load
before the clip within the loaded swf can be made available to
target. A better method would be to use the MovieClipLoader class,
and then use the onLoadInit handler, this handler is displatched
when the swf becomes available to the timeline, then within the
handler you could call your trace, or load into the 'head' instance
at the correct time.
I have made an example to demostrate this, using
representations of you clips and swfs:
HERE
PS. launch the items from within the folder. -
AIR crashes on loading swf with 'Imported for runtime sharing' fonts
Hello everybody,
I have a trouble with an AIR application developped with Flex but the error seems to come from the Flash/AIR, after some searches a staff member (Flex harUI) said me that I could find more help for my trouble here.
I'm developping an AIR application which loads an external swf. This swf contains 'Imported for runtime sharing' fonts from another swf to reduce its size.
When the AIR application has finished to load (see message below) the whole application crashes without giving any error message except the usual "Process terminated unexpectedly" error message.
End Loading: [SWF] C:\Users\dev02\myProject\index.swf - 83,930 bytes after decompression
Error Message:
Process terminated unexpectedly.
Launch command details: "C:\Program Files (x86)\Adobe\Adobe Flash Builder 4\sdks\4.6.0\bin\adl.exe" -runtime "C:\Program Files (x86)\Adobe\Adobe Flash Builder 4\sdks\4.6.0\runtimes\air\win" "C:\Users\dev02\Adobe Flash Builder 4\Languages_Editor\bin-debug\Language_Editor-app.xml" "C:\Users\dev02\Adobe Flash Builder 4\Languages_Editor\bin-debug"
I use Flash Builder 4 (build 272416) with sdk 4.6.
Full discussion here.
I tried to load the external swf with the most basics codes, it works with a Flash web app but not with a Flex/AIR app or a Flash/AIR app.
Thanks for the help !Thanks for the anwser.
In fact, I cannot specify a swc because my main application is an editor of sub-applications where each one has its own library.
The bug remains when sharing a simple MovieClip too.
Maybe, if I explain my project it will be a little more clear.
I'm developping a multi-languages module / application.
For each module, I have an external xml for texts. So in order to add a new language we don't need to recompile, just to change texts in the xml. But, I had to externalize my fonts, (imagine if each swf contains the whole characters set like latin, cyrillic, etc.).
And then, I have my main text editor application above the module, which loads texts xmls and a preview of the page where we need to change the text. (This is where it crashes, during the process of loading the preview).
My editor works great for translating, changing texts, modify images but without the preview, what is really frustrating.
(not so ergonomic, I know...)
I hope it will help you to understand my trouble.
regards -
Problem loading .swf embedded with HTML
Hi All,
I have embedded .swf file with HTML. It is working fine with
win xp and win 2003. But not working on win 2000 server.
I have set the MIME in IIS for .swf.
Please let me know what setting I should configure.
Thanks,
Aungdoes container exit on the timeline that contains your code?
is master.swf in the same directory with your flash swf and
html? -
Hi there,
The following code is in my main FLA....
quote:
// Request the content
var req:URLRequest = new URLRequest("PhotoViewer.swf");
// Create a loader object
var loader:Loader = new Loader();
// Load the content
loader.load(req);
// Add loader into the Display List
addChild(loader);
// Check loading progress
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,
checkProgress);
// Update progress bar
function checkProgress(e:ProgressEvent):void
var percent:int = (e.currentTarget.bytesLoaded /
e.currentTarget.bytesTotal) * 100;
loadingBar.text = String(percent + '%');
mcLoadingBar.width = percent;
// Check when content is loaded
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
contentLoaded);
// Remove the progress bar objects
function contentLoaded(e:Event):void
removeChild(loadingBar);
removeChild(mcLoadingBar);
removeChild(loadingBarBorder);
The SWF "PhotoViewer.swf" is a file that another Flash
developer built and released as an open-source tutorial and the
file uses a Document Class to create a Photo Gallery from an XML
file. The PhotoViewer SWF works fine on it's own, but when I try to
load it within my main SWF I get the following error message....
quote:
TypeError: Error #1009: Cannot access a property or method of
a null object reference.
at PhotoViewer()
TypeError: Error #1009: Cannot access a property or method of
a null object reference.
at PhotoViewer/init()
at PhotoViewer/frame1()
I can post the code for the PhotoViewer.fla and
PhotoViewer.as if it will help locate the problem as to why I'm
getting the above error.
NOTE: The PhotoViewer.fla and PhotoViewer.as file has been
updated by myself. Originally the PhotoViewer.as file's constructor
would call a function called "init();" and the init function would
specify the url of the XML file to load, but I have removed this
init() function call from the constructor and instead I have placed
this in the first frame of the PhotoViewer.fla and also updated the
function call so it specifies the XML file to load (e.g.
init("Portfolio-Identity.xml");).
I thought it might be some problem with my ActionScript code
loading the PhotoViewer.swf file, but I changed the loading url to
another SWF that I built myself and it loaded the file fine.
I'm not sure why I'm getting this error?
Any help really appreciated!
Kind regards,
MarkMy main FLA that is loading in the PhotoViewer.swf file has
the following code....
quote:
// Request the content
var req:URLRequest = new URLRequest("PhotoViewer.swf");
// Create a loader object
var loader:Loader = new Loader();
// Load the content
loader.load(req);
// Add loader into the Display List
addChild(loader);
// Check loading progress
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,
checkProgress);
// Update progress bar
function checkProgress(e:ProgressEvent):void
var percent:int = (e.currentTarget.bytesLoaded /
e.currentTarget.bytesTotal) * 100;
loadingBar.text = String(percent + '%');
mcLoadingBar.width = percent;
// Check when content is loaded
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
contentLoaded);
// Remove the progress bar objects
function contentLoaded(e:Event):void
removeChild(loadingBar);
removeChild(mcLoadingBar);
removeChild(loadingBarBorder);
The PhotoViewer.fla file has the following code....
quote:
init("Portfolio-Identity.xml");
And the PhotoViewer.as file has the following code (see
attached below)
Hope this helps.
Ta,
M. -
Hi all, can anyone help
can anyone shine a little light onto a little confusion I am having, I have a menu that already loads in images via an XML file on a menu, what I am trying to do is when an image/meni Item is click I would like to load in an swf into the same place as the image Item loads into! am I making any sense.
on a click event, do I use in the XML file the <link>link to swf</link> ????
this is what I have in my xml file that loads in the images so far;
<image name="image 12" path="img/img12.jpg"
title="Lorem ipsum 12"
text="Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi commodo 12" />
what I am getting confused with is what I also put within the AS, I am sure it is not alot but I'm just not sure what needs to go where??
this is what I have within the AS that loads in XML, I hope its ok to paste this code, never like posting to much code incase is scares people off, I just don't want to leave anything out, hope thats ok with everyone:eek:
// Use URLLoader to load XML
xmlLoader = new URLLoader();
xmlLoader.dataFormat = URLLoaderDataFormat.TEXT;
// Listen for the complete event
xmlLoader.addEventListener(Event.COMPLETE, onXMLComplete);
xmlLoader.load(new URLRequest("data.xml"));
stage.addEventListener( MouseEvent.MOUSE_WHEEL, onMouseWheel );
//———————————————EVENT HANDLERS
private function onXMLComplete(event:Event):void
// Create an XML Object from loaded data
var data:XML = new XML(xmlLoader.data);
// Now we can parse it
var images:XMLList = data.image;
for(var i:int = 0; i < images.length(); i++)
// Get info from XML node
var imageName:String = images[i].@name;
var imagePath:String = images[i].@path;
var titles:String = images[i].@title;
var texts:String = images[i].@text;
// Load images using standard Loader
var loader:Loader = new Loader();
// Listen for complete so we can center the image
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,onImageComplete);
loader.load(new URLRequest(imagePath));
// Create a container for the loader (image)
var holder:MovieClip = new MovieClip();
holder.addChild(loader);
var button_main:Button_mr = new Button_mr(); /
holder.addChild(button_main);
var tooltip:ToolTip = new ToolTip();
tooltip.field.text = titles; //loads tooltip 1
tooltip.field2.text = texts; //loads tool tip 2
tooltip.x = -350;
tooltip.y = 0;
holder.addChild(tooltip);
// Same proceedure as before
holder.buttonMode = true;
holder.addEventListener( MouseEvent.CLICK, onMenuItemClick );
// Add it to the menu
circleMenu.addChild(holder);
many thanks for any help!!!!1. Be sure in main.swf there is no masking or layering hiding
the reflection area. A way to test quickly is to load in a plain
master swf that is much larger than the externals swf.
2. Know the weakness of loadMovie for timing issues that
require the external movie to be fully loaded before actions are
taken on it. I see a bunch of these in the code you posted. Best to
use
MovieClipLoader.onLoadInit
before you attempt to access the external swf properties or code or
add code.
3. Be sure the code is firing on load and all objects are
created. Add some trace statements for those objects.
4. I noticed you do not use BitmapData so this may not be
relevant but be sure to add
System.security.allowDomain("*");
to the main.swf as well as in external swfs and only if you
are using the BitmapData class.
5. As I started to look at the code a bit and noticed this
item:
There is no constructor for the Flash MovieClip class. You
will not see a compiler error message because you do not have the
code wrapped into a class.
var home:MovieClip = new MovieClip();
However it does not have impact on the code.
better would be
var home:MovieClip; -
Problem loading swf which reads data in a local file
Hi,
Using flex with a online project, I have to load a swf file, which reads data in a xml file (it works fine if I open it with flash player)
I do a very simple test :
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
minWidth="955" minHeight="600"
>
<mx:SWFLoader id="swfloader" source="data/player.swf"/>
</mx:Application>
The result is that player.swf can't read the xml file (error : Error #2044: ioError non pris en charge : text=Error #2032: Erreur de flux. URL: enonce.xml).
I do the same test with an AIR project, and it works fine !!!!
It works also if I put the xml file directly at the same level as my compiled application (in bin-debug for instance).
I think that it's a path problem, but I don't know how to set it.
Is there any way to solve the problem ???
Thanks a lot !
OlivierHi,
Thanks for your answer, but I am not sure to understand it.
What code I have to adjust :
- the code of the swf I load ? It's a problem because I don't have access to the source code : my customer provides me only a swf file (with the xml file), and I have a lot of others swf files that work the same way, I can't ask him to modify everything.
- the code of my application ? I don't really see how to use LoaderUtil.createAbsoluteURL, because when I debug, I see in the SWFLoader code that when this method is called, the returned url is good !
Thanks for your help.
Olivier -
Loading resources with customized class loader
I have a customized classloader that keeps classes and resources in a table in byte[] form. It works fine as far as loading classes go, I just call defineClass with the byte array corresponding to the class. My problem is how to load resources. I already have the resource data in the table, which you'd think would be a good thing, but the method that has to be overridden (getResource or findResource) is supposed to return an URL to the resource. The only way I can think of to do that is to write the data to a file and return an URL to that file, but I don't even wanna touch that solution with a nine foot stick. Surely there must be a better way!?
Usually, when your resources are in a custom source, you create and implement your own URL protocol (like jar:). This is done by creating your own java.net.URLStreamHandler and java.net.URLConnection implementations. You can peruse the jar implementation in sun.net.www.protocol.jar as a good example.
Once you have your own protocol that knows how to get to your resource file and how to identify and extract a resource, you simply use that protocol in the URLs returned by your ClassLoader. The resource URLs can then be used as you would normally use any URL.
A tutorial describing how all of this works, and how to implement your own is at:
http://developer.java.sun.com/developer/onlineTraining/protocolhandlers/
I hope you find this of some help. -
Hello -- newbie problem/question (you can almost smell the
newbie-ness)
I am trying to load a SWF file (local file, in the same
directory as the FLA file) into a new Flash CS3/AS3 file and, after
a bit of searching, found information that led me to add the script
shown below. This script seems to do the trick, in that the swf
plays in the new file when tested/published. However, the original
SWF includes audio, and when I publish and test this file, there is
no audio. Can anyone point me in the right direction to load the
SWF along with the audio, using ActionScript 3? Thanks!Thanks again.
Well, the FLA file that I am creating as well as the
resulting SWF file are located in the same directory as the SWF
that I am loading into my new file (test_swf.swf). As I am just
testing, this directory is simply on my C drive.
The question that I cannot answer is how test_swf is calling
the audio. In a nutshell, someone at my company has a small pile of
SWFs and wants to make EXEs out of them -- none of the FLAs are
available, so I know none of the details of these files. I am
creating new FLA files and loading the SWFs, and then planning to
write out as EXEs. However, I get no audio.
Let me ask you this....should there be another step involved
in getting the audio, or should the audio "normally" play when the
SWF is loaded? -
Problem loading SWF file in FlashIsland
Hey,
I am trying to use FlashIsland for ABAP WebDynpro.
Unfortunately the SWF File is not loading. When I type the URL to the SWF File directly to the browser, the SWF file loads correctly.
In the header I have posted the statement: initialize="initApp()". My initApp I have implemented, too (see below).
import sap.FlashIsland;
public function initApp():void
FlashIsland.register(this);
What can be the problem there?
First I thougt it might be a problem of my Internet Explorer configuration or the customizing of the SAP System. But when I execute the WDR_TEST_FLASH_ISLAND application everything works fine there.
Thanks in advance for your help.
Kind Regards,
Thomas WeberSo,
I installed Flex Builder 3 with the Standard SDK 3.2.
Now i implemented a very simple Flex Project again:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="initApp()">
<mx:Script>
<![CDATA[
import sap.FlashIsland;
public function initApp():void
FlashIsland.register(this);
]]>
</mx:Script>
<mx:Label x="166" y="115" text="TEEEEESSSSSSSSSTTTTTT" width="399" height="161" id="LBL_TEST" enabled="true"/>
</mx:Application>
I get the same behavior like explained before. The Flash is not loading at all!
And again I cant do any right click on the page. I get an empty page loaded...
Please help me! What can be the problem?
Nice regards,
Thomas
Maybe you are looking for
-
Problems with DVR, STB`s
I had FIOS put in less than a week ago. The multi-room DVR recordings don`t show up on my STB`s. I have tried resetting them all at least 3 times. I tried resetting them through the internet, but it keeps saying login failed. In Home Agent freezes up
-
Dear all, We have found that excise base value is not updated after creating excise invoices,later we corrected it, excise base value started updating in table J_1IEXCDTL, Intially for 2 months excise base value is not updated in table, Is there any
-
Hello every1 I have tried to attach tooltip with a button and wrote a very simple program for CDC where tooltip is not shown. For confirmation when I compiled that code on J2SE and executed it, it was running fine and showing tooltip. Program is very
-
Can you compare Version to Master at same crop?
The M key for comparing a version to a master is really useful. What it does, however, is zoom from the cropped image version to the uncropped master. When I compare master to version, I'm really just interested in the color, brightness, etc. of the
-
Jinitiator problem - hand icon
Hi, I'm using: Oracle 8.1.7 Forms 6i Internet Explorer 6 Windows 2000 Jinitiator 1.1.8.16 The problem is that the forms program calls a reports program that generates a pdf file. Once the report has been generated the forms program calls: web_show_do