ActionScript 3.0 :: Loaded SWF Breaks If It Has Classes With Same Name As Main SWF?

Apr 7, 2009

We are migrating to AS3 at my job and I have run across a weird bug (???). I use the same basic class structure for most of my projects:Main.as - document class. handles preloader and sometimes XML loading, etc.Navigation.as - the class that handles all menu buttons, etc.Content.as - handles all the pages, game content, whatever.I created a game with this basic structure and published the SWF. Everything works great.Now, I built a website with this same basic structure and when I try to load the game SWF, it throws a bunch of runtime errors - it seems to be confused by the fact that the class names are the same.Each SWF works fine by itself. It only crashes when I try to load one into the other.

I should mention that both the game and website have identical package structure (because they are for the same client, duh!).Is this a flash player bug or am I doing something wrong? I went through the website and renamed all of the classes and it fixed the problem, but my concern is that we may have to load SWFs in the future that we didn't create. What if they have a similar issue? Unlikely, but possible.

View 6 Replies


Similar Posts:


ActionScript 3.0 :: Import Other Classes Into Main Class Or Extend Other Classes To Main Class?

Aug 1, 2011

how to get a Class file up and going in Flash and that works fine but say I want to import other classes. I try "import testCass" above in my import statements section of my as file and that doesn't work. What do I have to do to get that to work?

View 6 Replies

ActionScript 3.0 :: Exporting Classes On A Later Frame: Breaks All Nested Timelines?

Jul 14, 2009

I have a large flash app (> 100k) w/ its own looping preloader animation in the first frame. This preloader should happily spin while the app loads. (For various important reasons, I can't use a separate SWF to load the app.)Bug:When I export the classes in a later frame, all of the preloader animation's simple timeline commands (stop, gotoAndPlay) stop working.Test:I can reproduce this in a very simple test:The red ball should stop (as seen in example 1) and doesn't (example 2).Question:Do any of you know how to get around this? I've been trying everything I can think of and haven't found a solution. If this is unbeatable, it seems the only real timeline preloader you can do is a code-drawn progress bar

View 0 Replies

ActionScript 3.0 :: Attempt To Move Main Timeline From Inside A Movie Clip Breaks Menu Buttons?

May 4, 2010

I am attempting to have the main timeline move from a stopped position over a movie clip to frame 1, where my start menu is.The code I'm using does move the timeline but in doing so it somehow breaks the 4 buttons I have in frame 1.

My code in the movie clip:
stop()
function replayMovie(event:MouseEvent):void

[code].....

View 13 Replies

ActionScript 2.0 :: OnMouseMove Breaks When Loaded Into Master Movie

Mar 25, 2008

I (like many othes probably) am using a master flash movie (AS2) with a menu that loads external swf files into a container. It is working pretty well, but I'm running into a pretty nasty problem.

This particular external swf that I am loading has a menu made of images that scroll depending on the mouseposition. It is very similar to this: [URL]

Now, when running the swf on its own (not inside the master movie) it works 100%. BUT... seeing as I am going to load this into a master movie that is bigger (about 300px of menus to the left) I get problems with the positioning. I don't really know what the cause is but the imagemenu seems to think it has a bigger stage now and the images seem to fall behind my master-menu.

I have to find a way to restrict either the positioning of the images, or the mousemovement.

I tried fixing this by adding a square, the exact size of the external swf's dimensions. hit_mc

Code:
hit_mc.onMouseMove = function() {
if (!hit_mc.hitTest(_root._xmouse, _root._ymouse, true) || w<=hit_mc._width) {
return;

[Code]....

View 2 Replies

ActionScript 3.0 :: Flash Loaded Variables Breaks Switch Statement?

Jul 19, 2010

I've got a little script that scales a video to the stage. The scaleing function has a switch statement to indicate what kind of scaling to apply.If I declare the case value of the switch statement internally all is fine. However if I load this value from an XML doc, even though the trace indicated the value has loaded, the switch never fires.

Code:
/stage variables
var sH:Number;
var sW:Number;
var _contentHolder = new Sprite();

[code]....

View 2 Replies

ActionScript 3.0 :: How To Place 3 Classes In 1 Main

Feb 2, 2012

Maybe it sounds really stupid.. but I really dont have any idea how to place 3 classfiles named: Tower_Fire, Tower_Ice and Tower_Lightning into the main file:GameController.as
They're all the same, but I want to link them when I'm currently placing a tower. So as example, if I call Tower_Lightning.. that you can place the Tower_Lightning on the placing(spawn) where you want.However, with those 3 class files it's working, but I really want to put them all 3 in the main file instead.Tower_Fire.as:

ActionScript Code:
package Game
{
[code].....

View 5 Replies

ActionScript 3.0 :: Multiple Classes In A Main Class?

Nov 30, 2009

What is the correct way to import 'sub' classes into a main class?What i have is a class (i call it Console) that gives the user info about the swf for debugging, but also gives the user the ability to give their input to dynamically change the swf. Sorta like what games have when you press the "`" key.But it handles more things then just read user input, it also connects to the Database through PHP and connects through the server using Sockets.And there are more of those things that gets added later, so to prevent it gets to big later i want to split it into multiple .as files

Console Class: renders stuff and allows user input.I want that to include the following classes:

ConnectPHP Class (handles php > mysql)
ConnectJava Class (handles sockets)

So that the methods in those 2 classes are accessible in the Console class like:

[code]...

I tried importing them but then i had to access them through the Object initialized:

[code]...

But i want to access them as

[code]...

removing the reference of the ConnectJava Object. Is this possible? If you wonder why, id like to keep it as simple as possible because i share the classes with my friends.

View 2 Replies

ActionScript 3.0 :: Nesting Classes Then Calling Them On The Main Stage?

Jul 9, 2011

I having trouble nesting classes then calling them on the main stage.I have one AS file that contains all the functionality to create a simple button with a text field that can be customized from the FLA file. I want to use this AS file to create another AS file for a form.I have called the simple button from the AS file into my other AS using import RoundRectButton.

View 2 Replies

ActionScript 3.0 :: Overlapping Classes In Main Swf And Child Swfs

Dec 20, 2011

I have a project which has a main swf file that is compiled with a bunch of classes. The main swf also loads in other child swf objects, created in the flash IDE, that happen to reference some of the same classes.

It seems redundant to have the child swfs include the main swfs classes, especially if I update the classes which means I have to recompile all the child swfs, not just the main swf.

Im using FlashDevelop 4.0 RC3 with Flex 4.6/AIR 3.1 to code the main swf, and the child swfs are flas made in CS5.

I was thinking of using SWC's, but I'm not sure how to incorporate that into FlashDevelops workflow. I tried the SWC export plugin but that doesnt seem to work very well, it attempts to export everything in the project and doesnt seem to offer me an option to be specific...

Surely there is a way to compile flas from the IDE and allow for classes to be used for compile type checking etc, but not actually include them in the compiled swf? I know with the flex command line compiler you can generate a link-report xml from the main swf then use that xml file to exlude classes from the compile of the child swfs, but I cant see how to do something like that when exporting swfs from the flash IDE.

View 7 Replies

ActionScript 3.0 :: Add EventListener To Classes, When The Main Movieclip Is In Stage?

Jul 4, 2011

How to add EventListener to classes, when the main movieclip is in stage.

View 1 Replies

ActionScript 3.0 :: Working With The Main Stage Inside Of External Classes?

May 6, 2010

I'm working on a lot of different flash applications Most of those applications are visual and involves the main stage.I started oop a while ago and i got to a point that %99.9 percent of my code is extracted to different classes.There is one thing that repeat on a regular basis on all of my apps, passing the Stage variable to the different classes....It's working great but it doesnt feel right that i need to pass the main stage as a variable between the different classes,is there a better way to access the stage from external classes ? can i make the main stage a static property and access itwithin all the objects in the application ?

View 1 Replies

ActionScript 3.0 :: Retrieving File Names From Main Timeline Into Classes?

Jul 27, 2010

I have the following code on the main timeline. I have soundLoad_mc assigned to the SoundChgUrl class.soundLoad_mc.mp3URL = "climbing.mp3";soundLoad_mc.swfName = "journey.swf";The code below is from SoundChgUrl. The import to mp3URL works. The one to swfName does not - it throws "1119: Access of possibly undefined property swfName through a reference with static type classes:SoundChgUrl." This doesn't make sense to me.

package classes{ import flash.display.MovieClip;  import flash.net.URLRequest;  import flash.net.navigateToURL;  import flash.events.Event;  import flash.media.Sound;  import

[code].....

View 2 Replies

ActionScript 3.0 :: References To The Main Classes And To Add Event Listeners - Using A Command To Initialize

Oct 11, 2010

Before this application runs, I have to do some basic intialising - load up some stuff, build the display list, check I've got the right xml, wire a few objects together. I'm used to doing all of this stuff in the constructor of Main() - my main application class, but it gets a little unwieldy. Would there be any mileage in offloading this into a command class? Is that common practice? I was thinking that way all that Main() would have to do is just listen for events and manipulate methods of the other main classes. The only thing that concerns me is that Main needs references to the main classes and to add event listeners etc. This could be tricky if it's all set up in a command...

View 1 Replies

ActionScript 3.0 :: OOP: Multiple Classes - Add Functionality To The Buttons To Load Swfs Into Main Movie

Nov 2, 2009

I had to create a menu using array and I had to animate it. With some great expertise from people, I've accomplished that. But now I have a question about OOP, because I'm trying to add functionality to the buttons to load swfs into my main movie. Even though I strictly follow tutorials and exercises, I can't figure out how to reference a variable made in one class to another. For instance, I have index.as, navbar.as, and menubutton.as. I assume I need to add a loader to my index.as. But I can't trace the loader in my other classes. I've been told to effectively accomplish this, it is best to use custom event dispatchers. But I'm lost on how to use them.

View 12 Replies

ActionScript 3.0 :: Flashdevelop - Importing All Classes - Error 1065: Variable Main Is Not Defined

Jan 5, 2011

I just started using flashdevelop and I have some problems with importing all classes.

1. I used export all classes to SWC file and I added it to the library in FD. How can I import instances placed on the stage without creating AS linkages? I don't want to export these instances for AS, because some of them are textfields. By making linkages I'm forced to transform them to Sprite or MovieClip (am I right?) and my methods connected to these object don't work anymore.

2. When I export my project in FD, I get error 1065: variable Main is not defined. Main is my document class. I made this class my entry in FD.

View 1 Replies

ActionScript 3.0 :: Access Classes Loaded By Swf?

Aug 11, 2009

I'm stuck in a project because I don't know how to communicate with other classes in another external swf? After I load the swf using the loader class how would I be able to access the classes loaded by the swf?

View 2 Replies

Professional :: Unloading Loaded SWF Classes?

Jun 6, 2011

The first part is that I am downloading a SWF from a server that has a bunch of exported images in it. I am doing a lookup of the class names for these images then using that to load the data into the application. Later on down the line it is possible to download a separate SWF that has images in the same format with overlapping names.The issue here is that when loading the second SWF with duplicate names it doesn't overwrite the data as one might expect, it uses whatever was loaded first. So I need to know if it's possible to either make it overwrite the classes with the new data or throw them away before loading the new SWF so the old ones don't get in the way. Is this possible at all

View 4 Replies

ActionScript 3.0 :: External Swf Classes Loaded?

Mar 5, 2012

I have external swf (ext.swf) that is loaded in my FlashDevelop as3 project.When I make check (objectsList[0] is Class1) I am getting false even though the objectsList[0] element is Class1. The Class1 is in the ext.swfBut when I write command like (objectListInExternalSwf[0] is Class1) in external swf and then use that swf in my project and make check (objectsList[0] is Class1)My question is: do I have to use all the classes in my external swf so the compile

View 1 Replies

Actionscript 3 :: External Swf Classes Loaded?

Mar 5, 2012

I have external swf (ext.swf) that is loaded in my FlashDevelop as3 project.When I make check (objectsList[0] is Class1) I am getting false even thoughthe objectsList[0] element is Class1. The Class1 is in the ext.swfBut when I write command like (objectListInExternalSwf[0] is Class1) in externalswf and then use that swf in my project and make check (objectsList[0] is Class1)I get true. My question is: do I have to use all the classes in my external swf so the compilerhave to put them in the swf so they can be used in other projects where the swf is loaded as external?

View 1 Replies

ActionScript 3.0 :: Separating Classes From Loaded Swf?

Sep 10, 2009

In my code I have SWF A and SWF B.

SWF A loads SWF B.

The problem that I have is that both of the SWF's have a class of the same name but that have different member variables.

So from time to time depending on the scenario conflicts occur.

How can I avoid this?

I remember reading before about being able to separate the classes of two different swf but I can't find the article again

View 1 Replies

ActionScript 2.0 :: Access To Classes From Loaded Swf?

Jan 9, 2010

How to organize access to classes from the loaded swf?[code]...

View 1 Replies

ActionScript 2.0 :: Accessing Classes In Loaded Swf?

Jun 22, 2009

I have 2 swfs, one is main and it loads other file "skin.swf". skin contains object of custom class SkinClass. I can access it from main swf, but when I try to cast that object, the result is null. This happens when I use absolute url, when I load skin from relative url, everything is ok.

View 3 Replies

ActionScript 3.0 :: Overlapped Classes In A Loaded Swf?

Jan 31, 2010

I make flash games with a standardized UI. There are dozens of different *.fla files of different games, created at different times, and all them should share the same interface. My solution was to put this interface into a Library.swf and make every game load that file first and initialize the required classes. It worked perfectly.Now, the UI and the game had to exchange events. If the "Next" button in the UI is clicked, the game has to know it. The solution was create an InterfaceEvent class. The game calls

Code:
ui.addEventListener(InterfaceEvent.BTN_NEXT_CLICKED, desiredFunction)
and the UI dispatches

[code].....

View 2 Replies

Flex :: Add Classes And Functions To Loaded File?

Dec 17, 2009

I have a flex application that loads swf files and displays them using the SWFLoader object.is there a way to provide different classes and functions for the swf application to use? [code]...

View 1 Replies

Flash - Imported Classes Not Loaded Properly

May 31, 2011

I am trying to create a new flash movie. I am using CS4, for publishing movie -> flash 8 - AS-> 3.0. My issue is if I publish the movie I receive the following complier errors - > ActionScript 2.0 class scripts may only define class or interface constructs.
Attribute used outside class.
The class or interface 'flash.net.URLVariables' could not be loaded.
The class or interface 'flash.net.URLRequest' could not be loaded.
The class or interface 'flash.net.URLLoader' could not be loaded.
The class or interface 'flash.events.Event' could not be loaded.
The class or interface 'flash.net.URLVariables' could not be loaded.
ActionScript 2.0 class scripts may only define class or interface constructs.
The class or interface 'URLVariables' could not be loaded.
[Code] .....

View 1 Replies

ActionScript 2.0 :: Classes In A Precomplied Swf Being Overwritten When Loaded Into A Swf

Feb 3, 2009

I've a main swf thats loading a sub swf... simple

The sub swf has imported its own .as file to run some code.

The main movie also has its own .as file it has imported to run some code

See where I'm goin... ?

Problem is the .as files are in different folders, named the same name but have different code

When you load the sub swf into the main swf it tries to run the main swf .as file!

Anyone any solutions apart from the obvoius of renaming the files? At this moment this is not an option.

See my attached zip for sample files

View 3 Replies

ActionScript 3.0 :: Weird Error Involving Classes And Loaded SWF

Jan 28, 2010

My project is about a header.swf that calls a nav.swf (with a menu and other stuff) and also inits a slideshow through a Slideshow class.This is in header.swf:[code]I renamed the XmlParser class to "XmlParser2.as" (as well as other references to it) and then...it worked...what the hell was going on here?

obs: I tried that also: I commented all the code inside the "initSlideShow" function, keeping the XmlParser instantiation, and the nav.swf didn't show as well.

obs2 : i didn't had XmlParser.as imported cause it was in the root directory. ( i explicitely imported it and tried to compile but same thing happened)

obs3: nav.swf uses the XmlParser.as to load two menus, however I don't believe it has anything to do it since it's a file that is already compiled, at the point I try to load it into header.swf, right?

View 2 Replies

ActionScript 3.0 :: Classes Loaded With GetDefinitionByName Not Running Code

Feb 8, 2012

I recently discovered the incredible functionality of getDefinitionByName(), I'm attempting to load in pages for an interactive book.Each page has its own functions, listeners, nested animations, and timers.When loading in these pages, no stop()s are working within the nested clips, and any interactivty has been lost.It's just a mess of a bunch of animations running over and over.[code]

In addition to having the MovieClips not running code, I am running into serious garbage collection issues.I can unload the pages from display, but all sounds continue playing.Does anyone have an idea of why these loaded MovieClips are not running code, and why they will not unload properly with the destroy() method?

View 10 Replies

ActionScript 3.0 :: Clear Classes That Were Loaded From An External Swf Library?

Mar 9, 2010

Im working on a App that is using a external swf as a container for some graphical assets. An asset is a movieClip symbol with a class name attached to it. for example ASSET_1. I load the swf with the Loader class into the app. Its working fine I can also access ASSET_1 with this technic:

//--- inside onLoaded
var ASSET_1:Class = event.target.applicationDomain.getDefinition("ASSE T_1") as Class;
var asset:MovieClip = new ASSET_1() as MovieClip;
addChild(asset);

my problem start when im loading a second swf and than i try to access "ASSET_1" again, and the class doesn't update itself, the content is the same as in the firs one.

View 3 Replies







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