Loading swf in container in illustrator.
Not sure where to post this....
On the Mac, everything works fine. I load a .swf into an ADM Flash Player Item in the Illustrator SDK and the .swf pulls some information from an options.xml file on local machine to create the UI.
On Windows the .swf seemingly won't load info from other files on the computer. I can get the .swf to load inside the ADM Flash Player Item, but it seems like it can't access the options.xml file.
When I run the .swf OUTSIDE of the illustrator container, everything works as it is supposed to. I thought it might be a security/permissions issue, but wouldn't that come into play even when it's run outside of illustrator? I know I'm like the only person doing this kind of thing, but I'll take even wild guesses at this point!
Thanks,
Bill
P.S. Switching to CS5 is not an option for this project.
It was a security permissions issue. I had to set a compiler setting in flex builder to make sure I was in the "local" sandbox so I could access local files:
Right-click project -> properties -> flex compiler: under the additional compiler arguments add, "-use-network=false" without the quotes, obviously.
Similar Messages
-
How to unload externally loaded swf which contains 3D Carousel?
Hello to all
I am learning AS3 and have been taking on various tutorials found on the net. While learning about AS3 I came across a lesson on http://tutorials.flashmymind.com/2009/05/vertical-3d-carousel-with-actionscript-3-and-xml/ titled "Vertical 3D Carousel with AS3 and XML".
I completed the tutorial and all worked fine so I then wanted to load the swf into a existing project. The loading of the swf goes fine and when I unload my loader it is removed but only visually as in my output panel in flash CS5 I get an error as follows
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at carousel_c_fla::MainTimeline/moveCarousel()
this error repeats over and over again slowing my swf movie.
So does this mean my main flash movie trying to still play / find my unloaded 3D Carousel?
If so how do I unload remove all the AS3 that is trying to run from the 3D Carousel?
I have included the AS3 below from the tutorial page and I understand that this is what I have to remove to "break free" from the 3D Carousel swf when it is unloaded. This is where I am stuck as my knowledge of AS3 is limited - Can you guys / girls help?
//Import TweenMax
import com.greensock.*;
//The path to the XML file (use your own here)
// old var from tutorial - var xmlPath:String = "http://tutorials.flashmymind.com/XML/carousel-menu.xml";
var xmlPath:String = "carousel-menu.xml";
//We'll store the loaded XML to this variable
var xml:XML;
//Create a loader and load the XML. Call the function "xmlLoaded" when done.
var loader = new URLLoader();
loader.load(new URLRequest(xmlPath));
loader.addEventListener(Event.COMPLETE, xmlLoaded);
//This function is called when the XML file is loaded
function xmlLoaded(e:Event):void {
//Make sure that we are not working with a null variable
if ((e.target as URLLoader) != null ) {
//Create a new XML object with the loaded XML data
xml = new XML(loader.data);
//Call the function that creates the menu
createMenu();
//We need to know how many items we have on the stage
var numberOfItems:uint = 0;
//This array will contain all the menu items
var menuItems:Array = new Array();
//Set the focal length
var focalLength:Number = 350;
//Set the vanishing point
var vanishingPointX:Number = stage.stageWidth / 2;
var vanishingPointY:Number = stage.stageHeight / 2;
//We calculate the angleSpeed in the ENTER_FRAME listener
var angleSpeed:Number = 0;
//Radius of the circle
var radius:Number = 128;
//This function creates the menu
function createMenu():void {
//Get the number of menu items we will have
numberOfItems = xml.items.item.length();
//Calculate the angle difference between the menu items (in radians)
var angleDifference:Number = Math.PI * (360 / numberOfItems) / 180;
//We use a counter so we know how many menu items have been created
var count:uint = 0;
//Loop through all the <button></button> nodes in the XML
for each (var item:XML in xml.items.item) {
//Create a new menu item
var menuItem:MenuItem = new MenuItem();
//Calculate the starting angle for the menu item
var startingAngle:Number = angleDifference * count;
//Set a "currentAngle" attribute for the menu item
menuItem.currentAngle = startingAngle;
//Position the menu item
menuItem.xpos3D = 0;
menuItem.ypos3D = radius * Math.sin(startingAngle);
menuItem.zpos3D = radius * Math.cos(startingAngle);
//Calculate the scale ratio for the menu item (the further the item -> the smaller the scale ratio)
var scaleRatio = focalLength/(focalLength + menuItem.zpos3D);
//Scale the menu item according to the scale ratio
menuItem.scaleX = menuItem.scaleY = scaleRatio;
//Position the menu item to the stage (from 3D to 2D coordinates)
menuItem.x = vanishingPointX + menuItem.xpos3D * scaleRatio;
menuItem.y = vanishingPointY + menuItem.ypos3D * scaleRatio;
//Add a text to the menu item
menuItem.menuText.text = item.label;
//Add a "linkTo" variable for the URL
menuItem.linkTo = item.linkTo;
//We don't want the text field to catch mouse events
menuItem.mouseChildren = false;
//Assign MOUSE_OVER, MOUSE_OUT and CLICK listeners for the menu item
menuItem.addEventListener(MouseEvent.MOUSE_OVER, mouseOverItem);
menuItem.addEventListener(MouseEvent.MOUSE_OUT, mouseOutItem);
menuItem.addEventListener(MouseEvent.CLICK, itemClicked);
//Add the menu item to the menu items array
menuItems.push(menuItem);
//Add the menu item to the stage
addChild(menuItem);
//Assign an initial alpha
menuItem.alpha = 0.3;
//Add some blur to the item
TweenMax.to(menuItem,0, {blurFilter:{blurX:1, blurY:1}});
//Update the count
count++;
//Add an ENTER_FRAME listener for the animation
addEventListener(Event.ENTER_FRAME, moveCarousel);
//This function is called in each frame
function moveCarousel(e:Event):void {
//Calculate the angle speed according to mouseY position
angleSpeed = (mouseY - stage.stageHeight / 2) * 0.0002;
//Loop through the menu items
for (var i:uint = 0; i < menuItems.length; i++) {
//Store the menu item to a local variable
var menuItem:MenuItem = menuItems[i] as MenuItem;
//Update the current angle of the item
menuItem.currentAngle += angleSpeed;
//Calculate a scale ratio
var scaleRatio = focalLength/(focalLength + menuItem.zpos3D);
//Scale the item according to the scale ratio
menuItem.scaleX=menuItem.scaleY=scaleRatio;
//Set new 3D coordinates
menuItem.xpos3D=0;
menuItem.ypos3D=radius*Math.sin(menuItem.currentAngle);
menuItem.zpos3D=radius*Math.cos(menuItem.currentAngle);
//Update the item's coordinates.
menuItem.x=vanishingPointX+menuItem.xpos3D*scaleRatio;
menuItem.y=vanishingPointY+menuItem.ypos3D*scaleRatio;
//Call the function that sorts the items so they overlap each other correctly
sortZ();
//This function sorts the items so they overlap each other correctly
function sortZ():void {
//Sort the array so that the item which has the highest
//z position (= furthest away) is first in the array
menuItems.sortOn("zpos3D", Array.NUMERIC | Array.DESCENDING);
//Set new child indexes for the item
for (var i:uint = 0; i < menuItems.length; i++) {
setChildIndex(menuItems[i], i);
//This function is called when a mouse is over an item
function mouseOverItem(e:Event):void {
//Tween the item's properties
TweenMax.to(e.target, 0.1, {alpha: 1, glowFilter:{color:0xffffff, alpha:1, blurX:60, blurY:60},blurFilter:{blurX:0, blurY:0}});
//This function is called when a mouse is out of an item
function mouseOutItem(e:Event):void {
//Tween the item's properties
TweenMax.to(e.target, 1, {alpha: 0.3, glowFilter:{color:0xffffff, alpha:1, blurX:0, blurY:0},blurFilter:{blurX:1, blurY:1}});
//This function is called when an item is clicked
function itemClicked(e:Event):void {
//Navigate to the URL that's assigned to the menu item
var urlRequest:URLRequest=new URLRequest(e.target.linkTo);
navigateToURL(urlRequest);Hi Ned thanks for the reply,
Ok so I have a button in my main movie that loads the external swf
stop();
var my_loader:Loader = new Loader();
var my_btn:Button = new Button();
var my_pb:ProgressBar = new ProgressBar();
my_pb.source = my_loader.contentLoaderInfo;
my_btn.addEventListener(MouseEvent.CLICK,startLoading);
function startLoading(e:MouseEvent):void{
my_loader.load(new URLRequest("carousel.swf"));
addChild(my_pb);
my_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, finishloading);
function finishloading(e:Event):void{
addChild(my_loader);
my_loader.addEventListener("killMe",
killLoadedClip);
removeChild(my_pb);
function killLoadedClip(e:Event):void {
my_loader.removeEventListener("killMe",
killLoadedClip);
my_loader.unloadAndStop();
removeChild(my_loader);
Then I have a button in my loaded swf that closes the loader
This is spread over 2 frames
Frame1
function closeIt(e:MouseEvent):void {
parent.dispatchEvent(newEvent("killMe"));
Frame 2
back_btn.addEventListener(MouseEvent.CLICK, closeIt);
Frame 2 also holds all the code for the carousel
Thanks for your time and help in advance people ; ) -
I have created a movie that loads several swfs through an
empty container. I have tried changing file paths numerous times
and I can't get the movies to play correctly. Actually, they did on
our local testing server, but after uploading to the clients
server, the problems began.
My test page is:
http://www.sumnerhomemortgage.com/test/index.html
loader.swf initially plays part1.swf. Here is the code for
that:
loadMovie("
http://www.sumnerhomemortgage.com/test/flash/part1.swf",
container);Did you upload the FLV to the correct place?
I downloaded part1.swf, opened it in Flash, and got the
following error:
Error opening URL '
http://www.sumnerhomemortgage.com/test/flash/part1.flv'
If I paste that URL into the browser I get a 404. I also
tried it in:
http://www.sumnerhomemortgage.com/test/part1.flv
http://www.sumnerhomemortgage.com/part1.flv
and got a 404 for all of them -
Loading swf into SWFLoader before it is added to a container
I want to dynamically load a SWF file, before a particular view is created in a Flex 4.5 mobile app. Is it possible to load a SWF file into a SWFLoader before the SWFLoader is added to a container? I tried this but it didn't work.
I tried doing this using the AS3 Loader class and movieclips, but when I compile for iOS this method does not work for me. Is there a way to do what I want?Hello,
Firstly, why do you want to do this?
Secondly, you cannot run runtime-loaded SWF files on iOS devices.
By that I mean you can probably only use static SWF files like assets, but code inside them will not work.
If you still want to load it, try inside the initialize event handler. -
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 -
Embedded container swf loading swf with xml
I'd call myself an intermediate AS3 newbe. I have a series of slideshows that is called by a 'container' Flash file.
These slideshow swf files are now rather large (230 kb) so as a test, I redid one of them as a Flash file that uses xml rather than the images called within the file itself (file size 68 kb), which is my first exploration into xml & AS3.
All the non-xml files load and play fine locally (well, sort of, since there's some weird glitchs which show up in different ways at different times in the container loading too many files one after another at times - and sometimes there's no problem at all) but that's not my current problem here.
Basic URL structure: document relative
1. container file (container.fla/container.swf) will be embedded in a html file. --> /Flash.container.swf The contain file has a series of links to other .swf files.
2. The container file other .swf files (selection of 10) from a subfolder called /sbrds i.e. --> UILoader loads "Flash/sbrds/albert.swf"
3. The albert.fla/albert.swf loads an xml slideshow from a subfolder of sbrds called /AlBert --> /Flash/sbrds/Albert code "loader.load(new URLRequest("AlBert/AlBertXX.xml"));" (quotes in message only)
4. Inside the /Albert folder I have the xml file and all the images. xml file is AlBertXX.xml (attached)
5. local structure --> desktop/workingFiles/storyboards (container.fla) /Flash /sbrds (albert.fla) /Albert (Albertxx.xml & image.jpgs)
would equal on the server as root html/Flash/sbrds/Albert
Locally... The albert.fla (in the /Flash/sbrds folder) itself works fine with no errors when calling the xml file. But when I test that file from the container.fla/swf I get a 2044/2032 error "Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: file:///.../myLocalDesktopFolder/storyboards/AlBert/AlBertXX.xml at albert_fla::MainTimeline/albert_fla::frame1()"
I've check and rechecked for any typos in the xml slideshow test and don't find any. Any ideas?
Could it be that I'm calling a xml driven file from a non-xml driven file?
I have all the files including my buggy htm file at http://www.danwelter.com/susanTest_static.htm
All the pertinent fla and image files are in the /flash folder (too many to attach).
-- Thanks --- SusanHi Jan
Apparently the update went into place on my personal laptop
overnight last night. I awoke this morning to discover it had
rebooted itself and it was patiently waiting for me to enter my
bootup password. Anyhoo, I happened to notice that today when I
hovered the mouse over my Captivate movie, I saw the dreaded
“click to activate and use this control” message that
popped up in a tooltip. What to do?
Well, I did notice that it seemed to require a mouse click to
"activate" the control, but simply running the movie seemed to be
fine. I then wondered what would be disabled. When my movie got to
the first button, the initial click was used to enable the control.
Then the second click was accepted and progressed the movie.
I hopped out on the web and found a page at the following
URL:
http://www.amarasoftware.com/flash-problem.htm
After following the instructions there, my files seemed fine.
Here are the steps I followed:
1. Copied the code on the page and pasted into an empty
Notepad.
theObjects = document.getElementsByTagName("object");
for (var i = 0; i < theObjects.length; i++) {
theObjects
.outerHTML = theObjects.outerHTML;
2. Saved as file name ieupdate.js.
3. Copied the link code and pasted between the closing object
and center tags.
Before:
</object>
</center>
After:
</object>
<script type="text/javascript"
src="ieupdate.js"></script>
</center>
It occurs to me that one could easily modify the "seed" HTML
page Captivate uses when it creates the HTML page. This page is
named standard.htm and is found in the following location:
C:\Program Files\Macromedia\Captivate\Templates\Publish
This would save tweaking the HTM each time you publish. Then
you would only need to worry about making sure you copied the
associated ieupdate.js file to the same folder.
You gotta love lawsuits. I really hope those that "won" are
happy that we all now have to jump through all the hoops to make
things work. Sheesh
Hopefully this helps... Rick -
Getting statistic report on loaded SWF
Hi All
I am stuck in an isse. I have a fully Flash site, I have used
loadMovie functions all around the site for navigating the pages.
As this is a flash site, I have only one .html page, but I need to
know which page a user has visited most. For that I need to keep
the track of the loade movies, is there any way through which I can
keep a statistics of the loaded movies?
you may have a look on the site if you like, it's:
www.epocharchiving.com.
Awaiting a reply from some genious.
Regards
AmalenduThat would greatly depend on a 'backend'. When a swf is
loaded it can contain code that calls a javascript function in the
html page and that javascript could make a call to a 1 by 1 gif
(some programs that show statisticsu se this method). But using
server side software and the sendAndLoad() method of the LoadVars
object you could save the calls to the swf's in a database. -
How to effectively remove a loaded SWF from the stage?
I can not figure out a proper coding to remove a loded SWF from the stage.
Here is my set up.
I have a layout segmented into labeled section. In the section labeled "products" I have a layout consisting of product images acting as buttons which bring a user to another labeled section "prdctsPopUps"
In the "prdctsPopUps" section I have placed an instance of LoaderMax placed into an mc container. Placing LoaderMax into an mc container automatically resolved an issue of clearing loaded SWFs from stage when I come back to "products" section.
I specified the variable in the "products" section with the following set up:
var sourceVar_ProductsPopUps:String;
function onClickSumix1PopUp(event:MouseEvent):void {
sourceVar_ProductsPopUps="prdcts_popups/sumix1-popup_tl.swf";
gotoAndPlay("prdctsPopUps");
So each button has its own "....swf" URL and they all open fine and I can come back to "products" section without any issues.
However inside the swf (which loads through LoaderMax which is placed into an mc) there are other buttons which bring a user to labeled section "xyz". Which also functions properly. It opens as it is supposed to be and without any previously loaded "...swf" on the stage.
At the labeled section "xyz" there is a limited set of buttons repeating from section "products" which has to bring a user back to the same set up in the "prdctsPopUps" labeled section and open a corresponding "...swf" .
However only the last opened "...swf" will appear in that section. Effectively the one which was originally opened from the "prdctsPopUps" section and not the one which was supposed to be opened from the "xyz" section.
I can not understand why it would work from one labeled section and not from another. I can not figure out on which section which code/function needed to be placed.
Here is the set up from a button from the "xyz" section whcih supposed to bring a user to the same "prdctsPopUps" section but to load a different "...swf"
var sourceVar_ProductsPopUps_fromXYZ:String;
function onClick_floralytePopUp_fromXYZ(event:MouseEvent) :void {
sourceVar_ProductsPopUps_fromXYZ="prdcts_popups/floralyte-popup_tl.swf";
gotoAndPlay("prdctsPopUps");
Here is the code set up for the LoaderMax from the "prdctsPopUps" section:
var loaderProductPopUps:SWFLoader = new SWFLoader(sourceVar_ProductsPopUps,
estimatedBytes:5000,
container:holderMovieClip,
onProgress:progressHandler,
onComplete:completeHandler,
centerRegistration:true,
alpha:1,
scaleMode:"none",
width:540,
height:730,
crop:true,
autoPlay:false
function progressHandler(event:LoaderEvent):void{
progressBarPopUp_mc.gradientbarPopUp_mc.scaleX = loaderProductPopUps.progress;
function completeHandler(event:LoaderEvent):void{
var loadedImage:ContentDisplay = event.target.content;
TweenMax.to(progressBarPopUp_mc, 1.5, {alpha:0, scaleX:0.25, scaleY:0.25});
loaderProductPopUps.load();
Is there something which needs to be imported, or specific function needs to be specified in a specific labeled section?actually, i think you'll need to use something like:
var loaderProductPopUps:SWFLoader;
if ((loaderProductPopUps){
if(loaderProductPopUps.content)){
loaderProductPopUps.unload();
loaderProductPopUps= new SWFLoader(sourceVar_ProductsPopUps, //the value of sourceVar_ProductsPopUps allows to load mulitple SWFs from the products page.
estimatedBytes:5000 ,
container:holderMov ieClip,// more convinient and easier to manage if to place the LoaderMax into an empty mc (holderMovieClip)
// if not will work as well. Then the line container:holderMovieClip, has to be replaced with container:this,
// can be any size, can not be scaled as it distorts the content
onProgress:progress Handler,
onComplete:complete Handler,
centerRegistration: true,
//x:-260, y:-320, //no need for this is if used: centerRegistration:true,
alpha:1,
scaleMode:"none",
//scaleX:0, scaleY:0,
//vAlign:"top",
width:540,
height:730,//scales proportionally but I need to cut off the edges
crop:true,
autoPlay:false
function progressHandler(event:LoaderEvent):void{
progressBarPopUp_mc.gradientbarPopUp_mc.scaleX = loaderProductPopUps.progress;
function completeHandler(event:LoaderEvent):void{
var loadedImage:ContentDisplay = event.target.content;
//TweenMax.to(loadedImage, 1.5, {alpha:1, scaleX:1, scaleY:1});//only need this line if corresponding values are changed in SWF loader constructor
TweenMax.to(progressBarPopUp_mc, 1.5, {alpha:0, scaleX:0.25, scaleY:0.25});
loaderProductPopUps.load(); -
How to access properties of symbols in loaded SWF?
I'm making the migration from Flash to Flex, but I'm running
into a dead end on one particular area: accessing and manipulating
properties of symbols in a loaded SWF.
The SWF is actually a simple library of a detailed parts
illustration. I would like to load the entire SWF in position, and
be able to change the attributes (i.e. colors) of individual
symbols (or parts of the illustration). I can load, display and
manipulate each symbol separately, but I need the parts to remain
in place.
The original art was created in Illustrator and exported as
SWF using the symbols palette.
I can always go back to Flash, but I'm forcing myself to move
forward and do this project in Flex (baptism by fire!!).
Is there some sort of dot notation to access the symbols from
within the SWF, without loading them all separately?
Let me put this another way: it appears that I can load an
SWF and then instantiate each symbol in that SWF, and then load
each symbol to the 'stage' (or whatever it's called in Flex)
separately.
I can certainly instantiate each symbol separately, and then
align it on stage, but it seems to me to be bass-ackward to do it
that way, expecially since I created the original SWF with
everything in position.
Is there no way to access the attributes of the individual
symbols within an SWF without separately instantiating them?
I'm just having trouble getting my head around this. Any help
is greatly appreciated.Okay, I took a look at this info and it's what I was already
doing.
Here's a simplified example of what I'm trying to do, using
the example in the swf9.pdf file.
Let's assume I've created a SWF with a "BlueSquare" movieclip
(in the symbols panel in Flash, exported for AS). In that clip,
there is another symbol called "Star". I import the SWF and
BlueSquare symbols in with the following code:
<mx:Script>
<![CDATA[
[Embed(source=”../assets/circlesquare.swf”)]
[Bindable]
public var LogoCls:Class;
[Embed(source=”../assets/circlesquare.swf”,
symbol=”BlueSquare”)]
[Bindable]
public var LogoClsBlueSquare:Class;
</mx:Script>
If I instantiate the BlueSquare on stage, it includes the
Star symbol when previewed, but I can't figure out how to get at
the Star symbol to change color. If I apply a color change to the
symbol, it changes the entire BlueSquare symbol.
If I instantiate the Star symbol separately, I can then
position it on the stage and make changes, but that requires
positioning it with actionscript. I'm trying to not have to
position a sub-element of my actual artwork because of it's
complexity.
I'd like to display the main movieclip (or sprite) with the
ability to access the attributes of a sub-movieclip or
sprite. -
Can't Access MovieClips and Functions in Loaded SWF
Hi everybody,
I'm trying to simply access anything inside this loaded SWF and all I get is 'null'.
I have code in the parent SWF that needs to tell the child SWF movieclip what to do but nothing works. This was a piee of cake in AS2 and I can't seem to get anything to crossover in AS3.
Here's my code:
import com.greensock.TweenMax;
import flash.display.MovieClip;
var myLoader:Loader = new Loader();
var url:URLRequest = new URLRequest("SWCS_S3_500x250_exp_panel_2.swf"); // in this case both SWFs are in the same folder
myLoader.load(url); // load the SWF file
panel2.addChild(myLoader); // add that instance to the display list, adding it to the Stage at 0,0
panel2 = myLoader.content as MovieClip;
photo_about.alpha = 0;
photo_downloads.alpha = 0;
//panel2.content_about.alpha = 0;
//panel2.content_downloads.alpha = 0;
function closeSection():void
panel2.controlsMC.forcePause();
TweenMax.to(photo_about, .5, {alpha:0});
TweenMax.to(photo_downloads, .5, {alpha:0});
TweenMax.to(photo_home, .5, {alpha:0});
TweenMax.to(panel2.content_about, .5, {alpha:0});
TweenMax.to(panel2.content_downloads, .5, {alpha:0});
TweenMax.to(panel2.controlsMC, .5, {autoAlpha:0});
TweenMax.to(panel2.content_home, .5, {alpha:0});
panel2 traces null and all the clips loaded within pull up undefined property errors.
Can somebody please tell me what I'm doing wrong? I'd be stoked to know what I'm missing and feel like this should be a piece of cake.
Thanks for any help!You are not adding the content to the stage at 0,0, you are adding it to panel2 at 0,0. THen you take panel2 and assign it to be something that likely doesn't exist by the time you assign it. You need to wait until the loader completes loading before you attempt to do anything with its content, otherwise it has no content (null). Similarly, you cannot control anything in the loaded swf until it has finished loading. So assign an event listener to the contentLoaderInfo property of the Loader to determine when loading is complete, and have the event handler function deal with starting the interaction with it.
var myLoader:Loader = new Loader();
var url:URLRequest = new URLRequest("SWCS_S3_500x250_exp_panel_2.swf");
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, processLoadedSWF);
myLoader.load(url);
function processLoadedSWF(evt:Event):void {
// deal with the loaded swf here
// but you don't want to be assigning it to the panel2 object that contains the loader
As far as controlling anything inside the swf you load, is it an AS1/2 or an AS3 swf? -
TypeError: Error #1009 (loaded SWF)
I'm pulling out my hair on this one!
I'm just starting a site (full-Flash site) using CS3 and AS3.
I'm pretty much accustom to the new AS3 changes. I built a rough
structure to make sure the way I wanted to set the site up would
work (loading in external SWFs, etc.). The tests worked.
Now, I'm going in to make some things real, and I'm getting
this error as soon as an external SWF loads in:
TypeError: Error #1009: Cannot access a property or method of
a null object reference.
at test_fla::MainTimeline/test_fla::frame2()
I've tried narrowing it down, couldn't find the exact culprit
(had to remove every ounce of ActionScript before it started to
function again). So I started to rebuild that movie entirely --
cleared out the Library and deleted every layer. Didn't work.
Couldn't even add a stop(); action in Frame 1.
Then I started completely fresh File > New, rebuilt again.
I tested after every single change. I finally built it up to the
point where I first tested the original, and it worked. So, then I
added a couple more things tested again, and got the error again.
Ahh, so I removed EXACTLY what I had just added. Tested again. SAME
ERROR -- now it won't go away no matter what I remove!
Crazier yet is that I can still load in my other test SWF
files and they have actions in them, and they're set up the exact
same way -- but they work...
The whole site is new, so every SWF is CS3/AS3. I'm not even
doing anything crazy, so I'm getting pretty frustrated trying to
build an all AS3 site and I can't even do basic stuff....
I can upload/email the FLA files in question if anyone has
time to look...
Thanks,
BrandonWell, when I test the loaded SWF within the Flash environment
(by itself), it plays just fine.
Then, I try to play the root containing movie (both within
Flash and on the web server) and as soon as that section loads, is
when the error occurs.
I've tried tracing everything. even down to putting trace()
actions between every layer. Can't determine what causes it...
One thing I noticed (but I assume is a naming convention that
Flash uses), is in the error above you see "test_fla", well, lets
say I have these files:
test-container.fla
test-home.fla
I don't have a test_fla, but the error code refers to it
anyway... -
Setting External Loaded SWF dimension
hi guys...,
i'll be straight to point,well i'm now working on a project using action script 3 now what i'm trying to make is a Main SWF that load whatever other swf into it the tricky thing is that i used 1 xml document read the external swf source and it's setting(such as it's x,y position and it's width and height) and i'm having problem setting the loaded swf width and height btw it's an desktop application and not a website application.,
here is my code:
//variable list
var swfList:XMLList; //hold all the zone list from the xml
var totalZone:uint; //total of zone there is in the xml
var myURLLoader:URLLoader = new URLLoader();
var swf:Movie Clip;//hold the loaded swf
var swfLoader:Loader = new Loader();//loader instance used to load the external swf
var myCounter:uint = 0;
//load the xml file
myURLLoader.load(new URLRequest('myXMLFile.xml'));
myURLLoader.addEventListener(Event.COMPLETE, processXML, false, 0, true);
function processXML(e:Event):void
removeEventListener(Event.COMPLETE, processXML);
XML.ignoreWhitespace= true;
var myXML:XML = new XML(e.target.data);
swfList = myXML.SWF;
totalSWF = myXML.SWF.length();
loadSWF();
function loadSWF():void
swfLoader.contentLoaderInfo.addEventListener(Event.INIT, swfSetting);
swfLoader.load(new URLRequest(swfList[myCounter].@source));
function swfSetting(e:Event):void
//making new instance of sprite to hold the new loaded swf
swf = new MovieClip();
//casting the loader content into a movieclip
swf = e.target.content;
addChild(swf);
swfLoader.unload();
swf.x = swfList[myCounter].@left;
swf.y = swfList[myCounter].@top;
swf.width= swfList[myCounter].@width;
swf.height= swfList[myCounter].@height;
addChild(swf);
if(myCounter < totalSWF)
myCounter++;
trace('myCounter: ' + myCounter );
loadSWF();
and here is what the result ( it make the width and height of the loaded swf to 0):
swfLoader.contentLoaderInfo.width : 320
swfLoader.contentLoaderInfo.height : 240
module: MyVideo/flvplayer.swf
x:0
x container:0
y:0
y container:0
xml width:550
width container:0
xml height:400
height container:0
myCounter: 1
swfLoader.contentLoaderInfo.width : 550
swfLoader.contentLoaderInfo.height : 400
module: AnalogueClock.swf
x:50
x container:50
y:0
y container:0
xml width:250
width container:250
xml height:200
height container:200
myCounter: 2
swfLoader.contentLoaderInfo.width : 800
swfLoader.contentLoaderInfo.height : 30
module: MyNewsticker/newsticker.swf
x:0
x container:0
y:0
y container:0
xml width:300
width container:0
xml height:50
height container:0
most of my loaded swf beside the analouge clock is full action script code and in case of the analouge clock it is a swf that has a movie clip on it's stage (the other are fully created from action script 3.0)
please do help me..,
cause i'm already really desperate and going crazy by this problem..,sorry i copied the code from the other swf i used to do try and error test..,
basically the container is the same as swf varibale
here the code so you would'nt get confused:
//variable list
var swfList:XMLList; //hold all the zone list from the xml
var totalZone:uint; //total of zone there is in the xml
var myURLLoader:URLLoader = new URLLoader();
var swf:Movie Clip;//hold the loaded swf
var swfLoader:Loader = new Loader();//loader instance used to load the external swf
var myCounter:uint = 0;
//load the xml file
myURLLoader.load(new URLRequest('myXMLFile.xml'));
myURLLoader.addEventListener(Event.COMPLETE, processXML, false, 0, true);
function processXML(e:Event):void
removeEventListener(Event.COMPLETE, processXML);
XML.ignoreWhitespace= true;
var myXML:XML = new XML(e.target.data);
swfList = myXML.SWF;
totalSWF = myXML.SWF.length();
loadSWF();
function loadSWF():void
swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfSetting);
swfLoader.load(new URLRequest(swfList[myCounter].@source));
function swfSetting(e:Event):void
//making new instance of sprite to hold the new loaded swf
swf = new MovieClip();
//casting the loader content into a movieclip
swf = e.target.content;
addChild(swf);
swfLoader.unload();
swf.x = swfList[myCounter].@left;
swf.y = swfList[myCounter].@top;
swf.width= swfList[myCounter].@width;
swf.height= swfList[myCounter].@height;
addChild(swf);
if(myCounter < totalSWF)
myCounter++;
trace('myCounter: ' + myCounter );
loadSWF();
well in my code i did cast the loader into a movie clip and then set it's width and heigt,right???
wouldn't it just give me the same result??
if it's not can u describe what u mean in more detail??
some example about accessing the loader content would be really appreciated -
Loading swf into movieclip object
I am trying to load a swf file into a movieclip object on the
stage. The movieclip object is sized smaller than the screen, and
placed in the middle. I have defined a loader with:
var myMovieClipLoader:MovieClipLoader = new
MovieClipLoader();
then use it like this:
_level0.myMovieClipLoader.loadClip("moviename.swf",
_level5.movieclipinstancename);
(the movieclip object is used in a swf loaded in level5)
When I load the swf like this, the swf loads at the correct
location according to where I have placed the movieclip object,
however it "blows up" to fill the screen from that point down and
across, ignoring the size of the movie clip object (the loading swf
actually expands beyond it's created size to fill the screen,
making all the graphics and text much larger than intended). The
actual pixel size of the swf I'm trying to load matches the size of
the movieclip object (1024x350 in a 1280x1024 screen).
What is the magic setting or property that will tell the
loading swf to honor the size of the movieclip object I'm loading
into?
Thanks for your help!
BarbSomething I've been working on:
Place the following code in a new file <your project
folder>\as\MovieContainer.as
Then open the properties for the symbol you want to be your
movie container
Set the AS 2.0 Class to as.MovieContainer and give it a name
(I named mine 'loader').
To load the movie, simply call:
loader.queueSWF('my.swf');
Hope that makes sense. Basically, it's just a self contained
class for loading into an object on the scene. It draws a simple
progress bar on the center of the symbol when it's loading and it
resizes the loaded object on init to conform to the size of the
object on the stage. Why queueSWF? Well, if it's currently loading
a SWF, it will wait till it's finished and load a new one. The
biggest problem right now is the progress bar, but it's fairly easy
to remove if you don't like it. Hopefully it helps.
If anyone else is reading this. I'm trying to figure out if I
can load these movies into an array of movieclips. So far I've had
no luck. If you know of a way, feel free to drop some input. -
Memory leak when loading .swf in AS3?
Hi all,
I've got a pretty big issue here that I can't understand.
I've got a pretty simple app that just repeatedly loads and then
unloads an .swf called test.swf (this loaded .swf contains nothing
but a document class and a graphic - a circle. The document class
is blank, it just extends Sprite).
When I set this class as the document class of a blank .swf,
I trace the 'totalMemory' of the flash player, and load and unload
the (very simple) clip over and over. You'd think that with garbage
collection and all that, the memory would stay pretty
constant...but no! It increases (and continues to for as long as
I've run it!).
I'm writing an application that loads and unloads many many
.swf files, but it needs to have the smallest footprint
possible...any ideas as to why the memory is never released?One idea - there is a separate stack of memory in the flash
player where loaded classes in separate application domains exist,
and these classes are not being garbage collected....however, there
is a line in adobe's documentation here:
http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Liv eDocs_Parts&file=00000327.html
under "Usage C" :
quote:
Having a new application domain also allows you to unload all
the class definitions for garbage collection, if you can ensure
that you do not continue to have references to the child SWF.
Given that, as far as I can see from this code, there is no
reference to the loaded .swf maintained....it seems to me like the
loaded data (graphical assets AND classes) should be garbage
collected - but, while you WILL see a slight drop in memory after
the removal of the SWF, the overall memory continues to increase
the more you do it. Could Adobe be mistaken? -
Is it possible to load SWF files from an SQL database?
Hi all, I am very new to flash (I am primarily a C'# developer!) and I have been asked to investigate the possibility of doing the following;
Create an application that allows swf files to be uploaded and stored inside of a SQL database as binary data (Why a database is a long story!)
Allow this binary data to be extracted via a http request to be dynamically loaded inside of a web page.
Now the first part was easy. I have all of my swf's uploaded and stored inside of the database. I have code that can make a request for the binary and write it to the response, so far so good. Now this is where I am stuck.
I thought I could dynamically load the swf binary data by creating a very basic swf that simply contains a movie clip holder and for now a simple loadMovie statement. My idea being that I can could provide a url for the loadMovie statement that returns the swf binary data. This is where I have ground to a halt.
I can see the call being made from the swf, I can see the data being returned but I cannot get it to render. I remember seeing an article some time agao where someone stated that they had used this method with success but I cannot find now. Has anyone ever done anything like? Is it even possible? Am I missing something simple?
I have tried to return both the raw binary data and also used response.write but to no avail. Can anyone help?You are possibly trying to load AS3 swf into an AS2 Container at least the use of loadMovie() points in that direction. Be sure to use AS3 and target at least Flash 9 in your Loader/Main.swf. Also the AS3 concept of how to load swfs differs a lot from the old concept.
Look into the docu:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Loader.ht ml
But the biggest Problem seems to me -what you mentioned- that Loader needs a (defined) URLRepuest and since your swf files have no "real" URL and you surely don`t want to let the user directly write to your server, a workaround would be to write the BinaryStream with AIR-functionality to a local installlation directory and load it then from there.
Maybe you are looking for
-
What is the later Safari version supported on Mac 9.2
Hi, I am testing an application on Mac OS 9.2 and I want to know what is the latest version of Safari that I should use for this OS platform. Your advice is well appreciated. Thank you.
-
Attempting to copy to the disk "IPOD" failed.
message on comp: Attempting to copy to the disk "IPOD" failed. The disk could not be read from or written to. help?
-
Eprint not printing PDF's with HP LaserJet Pro 400 MFP M425dn
I have emailed several different pdf's from different devices not one has printed I receive the comfirmation email stating that eprint has received the job After logging into eprint the job history states that all the jobs have printed but None ha
-
Intracompany asset transfer of depreciation only
We have some assets that were loaded with our legacy load. They have no APC value, only Accumulated Depreciation. Is it possible to partially transfer these assets to other assets Accumulated Depreciation that have APC without affecting the APC of r
-
TCODE to find users Looged in the system
Hi Friends, I want to see all the USERS logged into any of the SAP system. Thanks, Ster