Xml command to load swf in holdermc pleeaassssee
xml command to load swf in holdermc pleeaassssee
im trying to have xml file load swf into a loadMC
cant figure this out
so button name would be:
<sub name="NAME" aW="0">
this is where id like to reference xml to load an external
swf file into a mc<swf src="1.swf" w="450" h="253" />
</sub>
Hello,
There really is no special XML command to load a SWF file
into Flash. All you need is the path/name of the SWF and the rest
gets done by Flash. So your XML would be better served this way.
<sub name="NAME" aw="0" swfname="1.swf" />
Similar Messages
-
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; -
How to create an xml to load swf files in sequence?
hello everyone
I'm new in web design... I know how to animate in flash, using timeline, frames, layers, twins and so on... But I want to move forward so I want to create a xml to load swf files in sequence and in loop. Each swf file has 8 seconds.You can see the example here in www.cm-seixal.pt.
I'm not a programmer but I understand how actionscript works... I hope you can help me
Cheers!
Anayou can use the urlloader class to load your xml file. use the loader's complete event and the loader's data property to retrieve the data in your xml file.
-
Load xml in share pod (swf)
I ran into a problem with a simple xml-menu. If you point the
shared document to the swf, it would not load the xml on your local
machine. I even tried it to place the xml in a separate folder
outside the breeze environment on a third party server.
One clue could be, to place it with an absolute path on the
breeze server, 'cause relative path doesn't work?
Any workarounds?if the swf is in a directory with subdirectory media which contains texto.xml, use:
obj_xml.load("media/texto.xml") -
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 -
Load SWF file in main SWF with parameters
Hello everybody,
I recently got a new flash Application which is a Photo Gallery.
This App is made of multiple folders (source files), a FLA file, a SWF with its javascript SWFObject and an Html page which instantiate this App with some parameters (size, config file path, ...).
It needs an XML file to find all the Photos it displays, to do it I need to configure my application in the HTML Page and give it the "xml_path" :
var so = new SWFObject("index.swf", "gallery", "249", "249", "10", "#111111");
so.addVariable("xml_path","load/config.xml"); // this line is adding the path to the xml file make sure that it's name is xml_path
so.addParam("allowfullscreen","true");
so.write("flashcontent");
By the way, I have a second application, the WebSite, which have to display the Gallery SWF in its "Gallery" page.
Here is how I do it at the moment (in ActionScript3) :
var swfRequest:URLRequest = new URLRequest("C:/......../Galerie/index.swf");
var swfLoader:Loader = new Loader();
//Charge le SWF Galerie dans le SWF Site
swfLoader.load(swfRequest, context);
container1.addChild(swfLoader);
//Positionne le SWF
swfLoader.x=10;
swfLoader.y=120;
It successfully loads the Gallery application but It shows an error telling me it doesn't find the XML configuration file... In the HTML file I simply had to write the "so.addVariable("xml_path","load/config.xml");" to tell where the XML file is...
So, my question is : How can I integrate my SWF application giving it some parameters like above, in Action Script 3?
Thank you ,
PatrickNo, nothing with HTML.
I have 2 SWF applications. One is the Gallery, and the second is my Main Page.
My Main Page must integrate the Gallery module in one of its page.
The problem is when I try to integrate it, I think I must give de future loaded SWF some parameters like this :
(My Main SWF loading in HTML)
var so = new SWFObject("WebSite.swf", "flashcontent", "520", "700", "10", "#111111");
so.addParam("allowfullscreen","true");
so.addParam("allowScriptAccess","always");
so.addParam("menu","false");
so.addParam("wmode","opaque");
so.addParam("bgcolor","#000000");
so.setAttribute("id","flash");
so.write("flashcontent");
It was for the Main App. For my Gallery SWF I had to load it like this (in HTML) :
var so = new SWFObject("Gallerie.swf", "gallery", "249", "249", "10", "#111111");
so.addVariable("xml_path","Galerie/config.xml"); // this line is adding the path to the xml file make sure that it's name is xml_path
so.addParam("allowfullscreen","true");
so.write("flashcontent");
So at the beginning I had 2 different projects with an HTML page for each.
Now I wan't to directly integrate the Gallery SWF into the Main SWF. And as you have seen I must give it some parameters such as the "xml_path" and "allowfullscreen". This must be done in ActionScript 3 and I don't know how...
I think I have to use FlashVars but I don't know how. As I said before, I have tried using the loaderinfo.parameters, but it is in read-only...
Do you have an idea of how I can make it work ? -
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've created a 'plugin' SWF file in CS3 using actionscript 3.
The purpose of this file is to be included as a postroll in the
open source flash media player JW FLV/Media Player (
http://www.jeroenwijering.com/?item=JW_Media_Player).
I have heavily customized the media player libraries to do
various new things/alter how things worked, and now want to be able
to include the SWF file within this into a child sprite/movie clip.
HOWEVER, the problem lies in that the media player is written
completely in AS2, and therefore I have to use the MovieClipLoader
class to load in the SWF. Updating the source to AS3 isn't an
option unfortunatly, and downgrading the AS3 SWF to AS2 isn't an
option either, mainly due to the fact I've learnt AS3, not AS2, and
find it frustrating trying to find the AS2 equivalent to the AS3
methods I know.
The problem though lies in that MovieClipLoader does not like
my SWF at all. Initially I was presented with a load of sandbox
errors from when it was loaded in, which I then resolved so that no
security errors are produced. However, whenever I load in the clip,
the target sprite/clip is empty. I have gone through checking that
no errors occur on load, and it reports that the loaded SWF has
been initialized, yet I see nothing. Also, the code loading the SWF
is not at fault as it loads any other SWF (even another AS3 SWF
which just creates a rectangle) no problem.
Oddly enough, using the MovieClip.loadMovie method works in
one situation - when you load it into the root of the AS2 file.
When loading it into an empty movie clip, the same problem of a
blank clip occurs. The problem is not specific to the media player
either, as it happened in any AS2 file where I was testing how to
load in the AS3 SWF.
If it is of any use, the sandbox errors produced by the AS3
file when loaded into AS2 swf I had to resolve where to do with
stage access for getting the stage height and width, and a
Loader.content error when pulling out the BitmapData. These were
resolved via setting the allowed domains policy and eliminating any
reference to stage.stageHeight/With.
Does anyone have any ideas on how to solve this? The only
possible solution I've been able to think of so far since the AS3
swf won't display is to play with the LocalConnection class as
tests showed I can communicate between the AS2 and AS3 files, but
this would have to be a last resort, and is less than ideal when
there can be multiple instances of the player running (I would need
to use unique connection names for each instance so as to prevent
player A interacting with player B, and also as only one of the
players can listen on the connection at once).I have the component in the top level also,
I get this error:
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/drawBackground()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\controls\BaseButton.as:615]
at fl.controls::LabelButton/draw()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\controls\LabelButton.as:724]
at fl.core::UIComponent/drawNow()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\core\UIComponent.as:1343]
at fl.controls::List/drawList()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\controls\List.as:594]
at fl.controls::List/draw()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\controls\List.as:474]
at .tree::TreeList/draw()
at fl.core::UIComponent/callLaterDispatcher()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\core\UIComponent.as:1532]
I've checked the definitions for the tree component,
The LabelButton and List I don't have much control over.
I'm not sure how to fix this. The xml is correct and loads easily if it's in the root document.
The list component doesn't load the labels, It stops on the first one.
What do I do next? -
How to detect the end of a loaded swf file
Hello Guys
This is my first time on this forum, come here with a great
hope
I have loaded a picture file (jpeg) and a video file (swf)
into the main flash file using xml
on frame 3, I load the picture and on frame 7, I load the
video, there is a stop action on frame 6
Now when the flash is executed the picture is displayed ( it
says "Click here to view the video")
when the user click the picture , the video is loaded and
starts to play ---- so far everything is working fine
now what I want to do is, once the video finishes playing (
not stoped) I want to display the picture again
can you tell me how to detect the end of an external loaded
swf files,
Please help me
Thanking You
Shriram -
How do I interact with a loaded swf?
Hi,
I have a "lesson" that I'm building that will display a series of "pages" based on an XML file. I have simple navigation buttons that work to page through the XML file. but I'd like to use load an external SWF file with buttons to use as my navigation panel. Everything is AS 3.0. The code to load the navigation movie looks like this:
// load navigator
navLoader = new Loader;
navLoader.contentLoaderInfo.addEventListener(Event.INIT, handleInit);
navLoader.x = 50;
navLoader.y = 200;
lessonSprite.addChild(navLoader);
navLoader.load( new URLRequest("Navigator1.swf"));
The loaded navigation movie has two buttons. How do I add an event listener to those buttons so that they call a function in the parent movie so I can detect when the user clicks on the button named "GoNext" in the loaded movie? I've tried several ways but I've had no luck. Could someone please point me in the right direction? This navigation panel is only one application of this sort of communication that I'll need in other parts of this type of lesson so I really need to figure out how to detect user interaction interaction with the loaded movie. Guess I need to know how to call a function in the parent movie from the loaded movie.
Thanks,
Peter H.Hey Pete,
The answer that you seek and the simplest one as well will be from the MouseEvent. that you will most likely have applied to your loaded swf.
As long as both swfs are in the same domain, you wont have any issues with security and therefor, the MouseEvent. which bubbles up, will be able to reach your swf file which has loaded it.
You can then write your code in your loaded swf to simply listen to the loadedMovieClip by targeting the contents of navLoader just like this,
navLoader.content.addEventListener(MouseEvent.MOUSE_DOWN,onDown)
protected function onDown(me:MouseEvent){
now providing you have given your two buttons names in your loaded swf, you will be able to perform addition tasks by receiving the name of the target.
protected function onDown(me:MouseEvent){
var btnClip:Movie= me.target as MovieClip
var btnName=btnClip.name
if(btnName==(button1)){
//do the following
}else{
//it was button two
button1 was just a random name in this case .
This will do the trick -
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 -
CellRenderer is not displaying icons in a loaded swf, throws null child addChildAt
I'm working with a component that extends List. It works fine unless it's loaded into another swf.
It cannot find the library symbols. I know the symbols exist in the loaded swf.
Is there a quick fix to this?I have the component in the top level also,
I get this error:
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/drawBackground()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\controls\BaseButton.as:615]
at fl.controls::LabelButton/draw()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\controls\LabelButton.as:724]
at fl.core::UIComponent/drawNow()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\core\UIComponent.as:1343]
at fl.controls::List/drawList()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\controls\List.as:594]
at fl.controls::List/draw()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\controls\List.as:474]
at .tree::TreeList/draw()
at fl.core::UIComponent/callLaterDispatcher()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\core\UIComponent.as:1532]
I've checked the definitions for the tree component,
The LabelButton and List I don't have much control over.
I'm not sure how to fix this. The xml is correct and loads easily if it's in the root document.
The list component doesn't load the labels, It stops on the first one.
What do I do next? -
(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 -
Could someone show me how to load swf file from a link on a
tree node? The tree would come from embeded xml.
ThanksI am getting 1034 Type coercion error. I have Googled it this
error must have hundreds of links. Is it a bug in Flex 3? Here is
the code. The problem only occurs when I link to a swf.
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Script>
<![CDATA[
import mx.events.ListEvent;
import mx.managers.*;
import mx.flash.*;
import mx.controls.treeClasses.*;
private var t:Tree;
private var dataObj:Object;
private var suffix:String;
private function tree_itemClick(evt:ListEvent):void {
var t:Tree = evt.currentTarget as Tree;
var dataObj:Object = evt.itemRenderer.data;
if (dataObj.hasOwnProperty("@src")) {
swfLoader.source = dataObj.@src;
} else if (t.dataDescriptor.isBranch(t.selectedItem)) {
swfLoader.source = null;
panel.status = "";
private function tree_labelFunc(item:Object):String {
var suffix:String = "";
if (tree.dataDescriptor.isBranch(item)) {
suffix = " (" + item.children().length() + ")";
return item.@label + suffix;
private function swfLoader_complete(evt:Event):void {
panel.status = (swfLoader.bytesTotal/1024).toFixed(2) +
'KB';
]]>
</mx:Script>
<mx:XML id="dp" source="data/dp.xml" />
<mx:HDividedBox width="100%" height="100%">
<mx:Panel width="200" height="100%">
<mx:Tree id="tree"
dataProvider="{dp}"
labelFunction="tree_labelFunc"
showRoot="false"
width="100%"
height="100%"
itemClick="tree_itemClick(event);" />
</mx:Panel>
<mx:Panel id="panel"
width="100%"
height="100%"
backgroundColor="white">
<mx:SWFLoader id="swfLoader"
scaleContent="true"
width="100%"
height="100%"
complete="swfLoader_complete(event);"/>
<mx:ControlBar>
<mx:LinkButton label="{swfLoader.source.toString()}"
/>
</mx:ControlBar>
</mx:Panel>
</mx:HDividedBox>
</mx:Application> -
Color external loaded swf in AS3 Help Urgent!
Hi i have loaded swf from an external path using the following command.
var cviewer:Loader=new Loader();
var curlRequest:URLRequest=new URLRequest("clipArts/"+evt.target.name);
So this is the scenario.
Suppose say i load Movie1.swf
I have three movie clips inside Movie1.swf called step0, step1, step2
I need to change the color of step0, step1 and step 2 from the parent flash file which loads movie1. All the inner movie clips color may be different from each other.
I am able to change the color of the whole movie clip by using
var colorInfo:ColorTransform = cviewer.transform.colorTransform;
colorInfo.color=evt.target.selectedColor;
cviewer.transform.colorTransform=colorInfo;
But not of individual ones. I even tried cviewer.step0.transform.colortransform and other stuff to see if it would work. But nothing worked. Help at fastest would be deeply appreciated.
Regards and thanks in advance.try:
var colorInfo:ColorTransform = MovieClip(cviewer.content).step0.transform.colorTransform;
colorInfo.color=evt.target.selectedColor;
MovieClip(cviewer.content).step0.transform.colorTransform=colorInfo;
Maybe you are looking for
-
Neo2 Platinum and AMD X2 ??
I am currently running an Athlon64 3500 in my Neo2 Platinum with BIOS v1.4. I want to upgrade my CPU to an Athlon 64 X2 3800 Dual-Core Will i have to upgrade my BIOS ? I`m running Windows XP Home. Can i easily flash the BIOS using Live Update ? I`ve
-
IS IT POSSIBLE 2 BUILD A NEW XML FROM DAMAGED ITL? SAVE FERRIS
OK. Here's my situation. I have an HP notebook running on VISTA. ITUNES version 8.1.1....... My computer shut off abruptly while I was running ITUNES and after I restarted it and started up Itunes, I got the damaged ITL message. No big deal, I still
-
Single-Tier in Dev / Multi-Tier in Prod - BPC5.1 - are there any issues?
Background: We are a new install of SAP BPC 5.1 and initially planned to have both Dev and Prod as a single tier install. In the Blueprint design review, the recommendation was made and accepted to have production as a Multi-Tier landscape. Due to
-
Robohelp, Firefox and 
Hi all, I'm reaching my wits end on this one. A couple of months ago I wrote in with a query regarding encoding issues when serving RoboHelp Webhelp pages from a Linux Apache server to Firefox. Peter Grainge very kindly supplied with a work around th
-
Create Multiple and Independent Calendars?
ML 10.8.5, Calendar 6.0, running on a mid-2010 MBP (2.4/4/320). iCloud not used; all the data is here on the desktop, none is updated or synched to or from the cloud. I have one calendar ("DB's Calendar") with all my events, and would like to create