ActionScript 3.0 :: Loading Class From An External .swf File?

Dec 11, 2009

My flash application has lots of resources which will change all the time. In order to keep the the user from having to download my main .swf file over and over again, and in order to keep the main file's size low, I would like to put the resources into separate .swf files and load them dynamically from a url using a Loader.
 
Once downloaded I would like to extract the classes that are in the resource swf and use them in the main swf. Can anyone share some code for doing this? Note that I am not just interested in using a symbol from the resource swf. I would like to use a class, with all of its methods and everything, and my main swf does not contain the class definition. Only the resource swf does.

View 3 Replies


Similar Posts:


ActionScript 3.0 :: Loading External XML File From FLA To Class?

Jan 14, 2009

I have been searching for information regarding the use of loading an external xml file from a variable (string) that contains the location of the item and passes it to the document class.

I receive the following error:
Error: Error #2136: The SWF file file:///C|/Documents%20and%20Settings/xmikxm0/My%20Documents/workingDocuments/freelance/brightStar/webSiteStructure/core.swf contains invalid data. at BuildSiteElements/::frame1()[BuildSiteElements::frame1:2]

FLA code:

ActionScript Code:
/* variables to load XML */
var BuildItems_obj:BuildSiteElements = new BuildSiteElements();
BuildItems_obj.loadSiteXML("templateBuild.xml");

[Code]....

fla is in same folder as class and the fla compiles the swf in another location (outside the folder and pulls xml from the xml folder).

View 3 Replies

ActionScript 3.0 :: Loading External Swf Which Attached With Its Own External Class?

Jun 27, 2009

Lets say I have Main.swf and sub.swf, and I wanna load sub when I press a button from Main, but sub.swf has its own external class file attached, so here is the problem, when I load sub using loader class and I would get this message from the output panel:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at subScript()

seems loader class can not access sub.swf's external class when sub is being loaded.

View 1 Replies

ActionScript 3.0 :: Class Is Loading The File But When Return It To A New Xml Object In The Document Class It Doesnt Load It?

Aug 18, 2009

I found myself loading a new XML file every day and so decided to create a small class that will load the xml file and return it.The class is loading the file but when i try to return it to a new xml object in the document class it doesnt load it.I think that it's something to with the return being in a nested function but i tried a few ways and non seems to work.
 
[DOCUMENT CLASS]
loadXML:LoadXML = new LoadXML();
myXML:XML = new XML(loadXML.loadXMLFile("gallery.xml"));[code].....

View 1 Replies

ActionScript 3.0 :: Creating A New Instance Fails When Base Class Is Assigned To An External Class File?

Jul 22, 2009

I'm trying to create a new instance of a MovieClip when the original one has been used. Would sound easy enough. Just use: var

instanceName:ClassName = new ClassName();

the class name/mc in the library im trying to duplicate is MCg1 so

var instanceName:MCg1 = new MCg1(); right?

However, the particular object in the library i'm trying to duplicate has a base class that is an external class file (just to control it's drag drop functionality)... i.e baseclass is not set to the standard flash.display.MovieClip, or whatever the case maybe. So i end out with a: TypeError: Error #1009: Cannot access a property or method of a null object reference.

View 6 Replies

Professional :: Loading Class From External Swf?

Jun 14, 2010

I found some code that let's you load variables from an external swf. I'm trying to adapt it so that I can use the symbols from external swf library in my main swf. I get an error telling me 'call to an undefined method...' and then the name of the symbol I am trying to import to the main swf (testMe123_MC). Here's the code of my external swf as:

[Code]...

View 1 Replies

ActionScript 3.0 :: Loading External SWF With Class

Dec 18, 2010

I have encountered a problem loading an external swf in my application. The external swf file is using a class and when I load it in my other flash it didnt load I think the class have a problem!!. I use the flash.system.ApplicationDomain and LoaderContext. It didn't have no effect in the my flash program.

View 0 Replies

Actionscript 3.0 :: Loading External Swf With Its Own Class?

May 17, 2011

I'm trying to load an external swf that's controlled by an xml file as I have loaded other swfs, but I get an error saying that it can't locate the class of the swf that I'm trying to load, and now it wont display an error, but it still wont open.Here's the code that I'm using to load this file:

function Main2(fla:MovieClip,m:MovieClip)
{
var newSWFRequest=new URLRequest(event.target.name + ".swf");
loader2.load(newSWFRequest);

[code]....

how to load this file in as3 and if you can please tell me how to add/remove & edit buttons in this swf.

View 2 Replies

ActionScript 3.0 :: Loading An External .swf From A Class?

Nov 19, 2010

so from using both my Actionscript 3 Bible and a friendly tutorial here on Kirupa... and another online, I attempted to create a class to load an .swf. I worked through the Kirupa tutorial, and it worked, but I wanted it to be in a class! This is where the problems come, when I run it, I get no errors, the bar flashes as if it's full, and it loads the content. When I try to simulate download however, the screen stays white and I receive an error

"Error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load Never Completed."

View 1 Replies

ActionScript 3.0 :: Loading External Image Using Class?

May 21, 2010

i am trying to load images on movie clips using class,but i did not get the visibility of images on those movieclips ,the class doesn't contain any errors the functions are also worked correctly. Here i am sending my class code :

package{
import flash.display.*;
import flash.net.URLRequest;
public class customerloading extends MovieClip{

[Code]......

View 1 Replies

ActionScript 3.0 :: Loading External Swf Document Class

Jul 31, 2009

I have created a image gallery. it uses a document class and several supporting classes. It works great. I need to load that swf gallery.swf into a another movie. When I try to do this I get this error. TypeError: Error #1009: Cannot access a property or method of a null object reference.at oxylus.rotator::Main()oxylus.rotator.Main is my document class for the gallery.swf that is being loaded into another flash movie.I don't get why it would cause errors as its a compiled swf and should not have references to that class.

View 1 Replies

ActionScript 3.0 :: Loading External SWF With Button With Class?

Aug 2, 2009

I'm trying out a game from a tutorial for a project, and I'm trying to load the next game from within the first .swf by means of a button, in this case loadButton, when this MC displays on the main swf (this is the GameOver menu screen). The syntax seems fine and there are no errors displaying, but the .swf itself isn't loading.The startLoad function I'm having problems with is at the bottom. I've tried loading external .swfs before but that was without classes... this is my first try with classes so I'm not sure if I named the public functions wrongly or put the wrong codes in the wrong places, screwed up my public vars, etc.

ActionScript Code:
package
{

[code].......

View 4 Replies

ActionScript 3.0 :: Loading Images By An External Class?

Jun 23, 2010

i got a problem with my gallery. my script only loads the loadImageComplete function, when all Thumb-Images are loaded. I want the loadImageComplete-function for every Thumb/Image.

Code:
function loadThumbs(src:Array,name:Array) {
var xPos:Number = thumbXStart;
var yPos:Number = thumbYStart;

[Code]......

View 0 Replies

Flash :: Loading External Swf And Assign It To Custom Class

Jan 21, 2011

I have a BuildingSprite that extend Sprite. I try to load external swf library into my main application. I have this code and it works fine:

[Code]...

View 2 Replies

Class - Flex Loading External Swf Prevents Other Functions?

Apr 8, 2011

I am able to use the Loader class to import an external swf into my project, its working great. But Im also trying to do a ImageSnapshot of the stage which works fine before the external swf is imported. After the swf is imported the ImageSnapshot no longer works. is there a event that the external swf is bringing with it that would disable it?

View 1 Replies

Flash :: Loading External SWF W/ Stage Reference In Class

Nov 17, 2011

I'm unable to load forces.swf (assume I can't edit it, as I don't have the source code) through an external swf, due to Stage reference in the base class how would I go about loading it (and any other possible SWF) without errors being thrown?

Here is a link to the problem I am trying to fix:[URL]..

View 1 Replies

ActionScript 3.0 :: Loading External HTML And Style With CSS Class

Apr 26, 2010

I'm trying to write a class that will have 3 parameters in a function call to specify: the dynamic textfield, an external HTML file, and an external CSS file. My attempts haven't worked, but I'm not getting many compiler errors. Here's my class file:

Code:
// loadText
// Loads external HTML file and styles it with an external CSS file
// Created by Al Lemieux on 2010-04-19.
// Copyright (c) 2010 Lemieux Design. All rights reserved.

[Code].....

View 1 Replies

ActionScript 3.0 :: Loading External Classes Into Document Class?

Sep 7, 2010

I am trying to load external classes into a document class and initialize the page by loading one of them (which loads xml and videos) I feel like I should be able to do this but have not found documentation on this. Below is the code i am using...

package {
import flash.display.MovieClip;
import flash.net.URLLoader;

[code]....

View 1 Replies

ActionScript 3.0 :: Loading External SWF With Its Own Doc Class Giving Errors

Oct 20, 2010

I am busy with a big project, for a brief outline, its an induction program kind of like a media rich slideshow done in flash (AS3). It consists of 10 chapters / modules, each module is a SWF with its own class file. Each module loads external and embedded videos and also mp3 sound voice overs at run time.

Each module loads and works fine by itself, but now the problem comes in where I am trying to create a main container swf to load and unload each of the other 10 module swfs, sequentially (ie first load module 1 swf, then when module 1 swf is finished, unload it and load module 2 swf etc)

I have researched for days and realize that when loading external swfs that have their own class files, problems arise because the external swf makes references to stage but it does not have access to the stage yet and I need to use something like this.addEventListener(Event.ADDED_TO_STAGE, whateverFunction) in the constructor of the external file, and "... the loaded content must be on the Display List BEFORE any code in it referencing 'stage' is executed. " as quoted from Barbara Kaskosz's experiment on flashandmath.com. (I cant post links as I am under the 50 post restriction).

After trying for days with this and other guides I found, I still have not been able to successfully apply it to my projects files. If anyone would be willing to take the time for me to send them some sample files maybe my container FLA and two of the smallest modules and have a look at what I've done

My deadline is approaching fast and failing this deployment phase of combining all the swfs into one executable is like tripping at the finish line.

I am posting a link to my simplified and cut down files (for testing purposes) in hopes that someone may assist me. I also want an event to fire on the last frame of each of the modules, and for the main.swf to listen for it so it can unload the current module and load the next module.

dispatchEvent(new Event("loadNextModule", true));
//I think this should go on the last frame of the last slide of each module,
//then in main.as add a listener
addEventListener("loadNextModule", nextModule);

But would this listen for the event firing in an external swf?

I have deleted a lot of content in the modules to help with testing purposes, and simplified and made them only 3 slides each.

TL;DR : I have a container swf with a single movieclip that will contain external swfs that will load one at a time. Each swf works fine by itself, but I get errors when compiling the container swf because (I assume via research) the container swf AND EACH external swf has its OWN class file. In summary, I need the main swf to start by loading module1.swf, then when the user reaches the last slide of module 1, main.swf needs to unload module1.swf completely and then load module2.swf. You can traverse slides by pressing the 'right' and 'left' keys on the keyboard.

This is the error I am getting when compiling main.fla :

TypeError: Error #2007: Parameter child must be non-null.
at flash.display: DisplayObjectContainer/addChild()
at main/loadFirstModule()
at main()

I am attaching what code files I can given the restrictions, if you still require the two external .fla files

View 0 Replies

ActionScript 3.0 :: Custom Loader Class - Loading External SWF In FLA

May 17, 2009

I've been trying to figure this out for the past couple of days and couldn't find a solution and Im sure its something I have completely overlooked on my part. I'm attempting to load in an external swf in my fla file using this custom loader class I created. I keep receiving this error in an attempt to load the swf, which is in the same directory as my fla file that is loading it:

TypeError: Error #2007: Parameter url must be non-null.
at flash.display::Loader/_load()
at flash.display::Loader/load()
at com.proj.load::SWFLoadClass()
at test_fla::MainTimeline/frame1()

Code from SWFLoadClass.as:
package com.proj.load {
import flash.display.Loader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.display.MovieClip;
[Code] .....

Code in fla file:
import com.proj.load.SWFLoadClass;
var l:SWFLoadClass = new SWFLoadClass("colorPicker.swf", 0, 0);
addChild(l);

View 1 Replies

ActionScript 3.0 :: Loading External Images Won't Work Within A Class

Aug 27, 2009

I'm trying to load external images in the usual way;

Code:
loader=new Loader();
loader.load(new URLRequest(_thumb));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,onLoadComplete);
private function onLoadComplete(e:Event):void{
thumb.addChild(loader);
}

But when it comes through to the onLoadComplete Function, I get a sandbox violation. I've tried using Security.allowDomain and a crossdomain.xml file, but it just won't work. Even more annoyingly, if I do the exact same thing, but within the main class file, it works fine.5 or so of these classes that need to load images are loaded from an XML file (which also works fine without allowdomain etc). Is there some sort of conflict going on because of there being more than one of them?

View 1 Replies

ActionScript 3.0 :: Loading External SWF With Its Own Doc Class Giving Errors?

Oct 19, 2010

i am still on the same big project, if anyone read the post - but for a brief outline, its an induction program kind of like a media rich slideshow done in flash (AS3). It consists of 10 chapters / modules, each module is a SWF with its own class file. Each module loads external and embedded videos and also mp3 sound voice overs at run time.

Each module loads and works fine by itself, but now the problem comes in where I am trying to create a main container swf to load and unload each of the other 10 module swfs, sequentially (ie first load module 1 swf, then when module 1 swf is finished, unload it and load module 2 swf etc)

I have researched for days and realize that when loading external swfs that have their own class files, problems arise because the external swf makes references to stage but it does not have access to the stage yet and I need to use something like this.addEventListener(Event.ADDED_TO_STAGE, whateverFunction) in the constructor of the external file, and "... the loaded content must be on the Display List BEFORE any code in it referencing 'stage' is executed. " as quoted from Barbara Kaskosz's experiment on [URL]..

After trying for days with this and other guides I found, I still have not been able to successfully apply it to my projects files. If anyone would be willing to take the time for me to send them some sample files maybe my container FLA and two of the smallest modules and have a look.

TL;DR : I have a container swf with a single movieclip that will contain external swfs that will load one at a time. Each swf works fine by itself, but I get errors when compiling the container swf because (I assume via research) the container swf AND EACH external swf has its OWN class file.

View 1 Replies

ActionScript 3.0 :: Loading External SWF With Stage Reference In Class?

Nov 17, 2011

I'm unable to load forces.swf (assume I can't edit it, as I don't have the source code) through an external swf, due to Stage reference in the base class.

How would I go about loading it (and any other possible SWF) without errors being thrown?

Here is a link to the problem I am trying to fix:

[URL]

View 14 Replies

ActionScript 3.0 :: Loading External Swf - Works From Document Clas, But Not From A Different Class?

Nov 1, 2009

This is simple, however I am having trouble. I am adding a swf to the stage in my Document class (Test.as) - it works. I am trying to add the same swf to the stage in a different class called Control.as, it doesn't work. Can someone please help and explain what I am doing wrong?

// Document class Test.as
// Adding bg.swf to the stage - this works....
package ca.blah (

[code].....

View 4 Replies

IDE :: Loading External Php File?

Apr 11, 2009

loading external php file,this mean,when we load the file all info at php will load actionscript in swf file.

View 2 Replies

Loading Different Vars In External Txt-file?

Dec 8, 2009

In first frame of my movie I've got this:

PHP Code:

loadVariablesNum("produkter.txt", 0);
import TextField.StyleSheet;
var myCSS:StyleSheet = new StyleSheet();

[Code]....

and a dynamic textbox called "myHTML". If I name 'var' on this textbox everything works fine, but I want to write it in actionsscript instead. Where do I write that? (I have 3 different vars in the text-file)

View 1 Replies

Flash :: External Xml File And Loading?

Jun 28, 2006

I'm calling an external xml file and loading it into Flash. I can only pull the varables out in the onLoad function. Here it is.

var courseXML:XML = new XML();
courseXML.ignoreWhite = true;
courseXML.load("presentSlidesOne.xml");
courseXML.onLoad = function(bSuccess:Boolean):Void {

[Code]...

View 5 Replies

ActionScript 3.0 :: Loading External .swf File?

Feb 24, 2011

I'd like to load external .swf file after clicking a button, so the new file replaces current one which is pretty much the same but in different language. Here is the file http:[url].... I'd like the little red&white button to do the work.I though this code would do the job, but something is missing here:

FlagPL_btn.addEventListener(MouseEvent.CLICK, webEng);function webEng(event:MouseEvent):void{windowLoader.source="AyeAyeMedia FOTO VIDEO AUDIO

View 4 Replies

ActionScript 1/2 :: Loading External As File Through Url?

Apr 12, 2011

I have external actionscript files that I call like this:
 
#include "../events/allevents.as"

But if I want to inport the full URL i.e. #include [Url] it does locate the file although it is the correct URL. How can I set this up so it always calls the server as and not my local as file

View 3 Replies

Actionscript 3 :: Loading External SWF File?

Oct 3, 2010

I am building a SWF player which loads external SWF's. Rite Now. I could call the external SWF using URLRequest.

but I am getting 2 problems How to run the SWF with the frame rate of the actual SWF movie. How can I know the frameRate of external SWF dynamically from within AS3. I have set a layer of 450px by 350px. How do I scale the external SWF with showall property to fit in the layer.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved