ActionScript 2.0 :: Using Class Defined In External SWF?
Jul 7, 2008
I have two SWF files loader.swf and external.swf, external.swf is sitting on a remote server and I load it up from loader.swf using MovieClipLoader. external.swf includes a class definition for SomeClass by including a .as file, which also sits on the remote server. External.swf defines a method that returns an instance of SomeClass.
Once I've loaded up external.swf via loader.swf I can call the function that returns an instance of SomeClass. The problem is that laoder.swf seems to require a local copy of the as fiel that defines the class, rather than being able to receive the information it needs from external.swf, I really need to keep this class definition on the remote server, and not have a copy of it locally. Is thre any way I can encapsulate this within external.swf? I'm free to cahnge whatever I like.
View 4 Replies
Similar Posts:
Feb 9, 2010
I am using flex builder 3.2, Action Script 3 and develop for Flash Player 10 and am quite new to it. when I call a method of a self defined class, I get the 1061 error (not defined). But the class and the method exist and are public, so what the hell am I doing wrong? Flash Builder is even offering me this method in the auto-completion, so at least the builder knows it... I have already tried cleaning the project (as this is the common source of strange errors when working with java/eclipse),
edit: solved... The problem was that a package had the same name as the variable I used for the class. Very strange error message, thumbs down for this .
View 0 Replies
Aug 16, 2010
I have two classes. The Main class calls a function, which is defined in a Second class.I'm getting the following error:Error 1120: Access of undefined property myFunctionBasically, I am creating buttons in the Main class that will add a corresponding Child to an Object in the Second class (if you click one button, child x1 will be added, if you click another button, child x2 will be added, and so forth).Here's the relevant code for the Main.as file:
package
{
import flash.display.MovieClip;
[code].....
View 3 Replies
Mar 14, 2011
I've only been programming in as3 for a couple months, and so far I've written several compositional classes that take MovieClips as inputs to handle behaviors and interactions in a simple game I'm creating. One problem I keep coming upon is that I'd love to access the custom variables I define within one class from another class. In the game I'm creating, Main.as is my document class, from which I invoke a class called 'Level1.as' which invokes all the other classes I've written.Below I've pasted my class 'DieLikeThePhishes'. For example, I would love to know the syntax for accessing the boolean variable 'phish1BeenHit' (line 31) from another class. I've tried the dot syntax you would use to access a MovieClip inside another MovieClip and it doesn't seem to be working for me.[code]
View 1 Replies
Mar 14, 2011
I've only been programming in as3 for a couple months, and so far I've written several compositional classes that take MovieClips as inputs to handle behaviors and interactions in a simple game I'm creating. One problem I keep coming upon is that I'd love to access the custom variables I define within one class from another class. In the game I'm creating, Main.as is my document class, from which I invoke a class called 'Level1.as' which invokes all the other classes I've written.Below I've pasted my class 'DieLikeThePhishes'. For example, I would love to know the syntax for accessing the boolean variable 'phish1BeenHit' (line 31) from another class. I've tried the dot syntax you would use to access a MovieClip inside another MovieClip and it doesn't seem to be working for me
package jab.enemy
{
import flash.display.MovieClip;
[code].....
View 1 Replies
Apr 19, 2005
Can anybody tell where the class functions are defined?[code]
View 1 Replies
Apr 19, 2005
where the class functions are defined?
e.g. the function function toUpperCase():String; in
C:Documents and SettingsuserIdLocal SettingsApplication DataMacromediaFlash MX 2004enConfigurationClassesString.as
View 1 Replies
Oct 6, 2010
How can i list all the names (and values) of public (and private / protected) const defined in a class ?
[code]...
View 3 Replies
Oct 14, 2009
I am trying to create a circle instance of FirstCircle class (by Milan Toth):
ActionScript Code:
package
{
import flash.display.Sprite;
[Code].....
I supposed the constructor would do all the work then. When testing the movie I get no error but no circle was displayed, trace statement put in the class constructor displayed the message ok. When I put the class code directly to the ACTION FRAME, it works fine.
what should I do to get the circle visible in the fla using the FirstCircle class?
View 6 Replies
Oct 15, 2009
I have a class that contains a MovieClip and a String.In my library there are 3 exported MovieClips: Movie1, Movie2, Movie3.I want to define 3 variables of this class and each with a different MovieClip and String.[code]...
View 5 Replies
Feb 2, 2010
I have a very simple class[code]...
when I click I get "undefined"
How do I get at references that are defined within a class when I am on the timeline
View 5 Replies
May 22, 2010
I'm trying to set the height of a vertical bar (activityBar) but it does not appear to do anything. i have tried something similar with the whole component, but setting the dimensions does nothing (even in the mxml used to instantiate the class). Indeed, I've added transparent graphics just to give the component some dimensions
FYI: I'm trying to create a mic activity bar that will respond to the mic by simply setting the height of the activityBar child (which seems to me to be more efficient than redrawing the graphics each time).
package components {
import mx.core.UIComponent;
public class MicActivityBar extends UIComponent {
public var activityBar:UIComponent;
[code]....
View 1 Replies
Aug 3, 2011
I've got a string which, in run-time, contains the name of a class that I want to instantiate. I read suggestions to use
flash.utils.getDefinitionByName():
var myClass:Class = getDefinitionByName("package.className") as Class;
var myInstance:* = new myClass();
However, that gives me the following error:
[Fault] exception, information=ReferenceError: Error #1065: Variable className is not defined.
View 1 Replies
Jan 16, 2012
This is quite strange to me since the MouseCursor class is being used as static.
Mouse.cursor = MouseCursor.BUTTON;
This is what I am using the MouseCursor class as and hence it is static. We got this error posted by a customer and the customer has also attached a screenshot of the error.
ReferenceError: Error #1065: Variable flash.ui::MouseCursor is not defined
I first assumed that this could be perhaps because he was running an older version of Flash Player ( older than v10 ). But his screenshot clearly shows that it is running version 10 of the flash player.
View 2 Replies
Feb 6, 2012
I have defined some sprites in a class .as file and I want to put them in the screen. How can I do this?
View 2 Replies
Oct 22, 2009
Ive got a flash file linking to a FMS, its just going to be a little game, all connects fine and I have a chat client working through this. My problem is when i come to use classes to import movieclips ect...
When i set the main Class name in the properties menu and play the swf, NetStatusEvent and SyncEvent are give me the following error...
1046: Type was not found or was not a compile-time constant
If i remove the main Class name the swf connects to the server fine, or if i remove the code for the connection to the server and play the swf my movieclip attaches and behaves as the class files intended.
i may be doing a fundamental error here but i really cant see it and its annoying with the 2 aspects running independently but not together.
View 1 Replies
Jan 18, 2006
Code:
class className () {
//constructor
function className(targetmc,linkId) {
[code]....
My question is how can I set up an interval when I click on a button that is created from within the class.
I need my function updater to keep repeating untill I clear the interval.The only way I can figure out is to give the full path like this._parent._parent.instanceName.updater inside the setInterval, but although this works I think is just dumb to hardcode the instace name of the class. I could of course try to pass the instance name as a parameter, but I would really love to find out the smart way to do this (by the book).
View 3 Replies
Mar 3, 2009
I have been trying to migrate a CS3 based Flash project to the new CS4 IDE for some days, but it has been impossible. All the conponents of the library throw the same error at building time:
ReferenceError: Error #1065: Variable <Class> is not defined.I have changed the name of all clases with the same name as
the package,
I have also changed the name of the main class.I have created a new empty .fla to copy and paste all the elements of the library,BUT I DO NOT STILL GET TO SOLVE THE PROBLEM.
View 11 Replies
Feb 21, 2012
When coding in the Flash IDE, i very often use the following procedure to create specialized versions of MovieClip classes:I design my object in the IDE, for example, i add two buttons and give them the instance names "btn1" and "btn2". Then i select them together and convert them to a symbol. I then select Export for ActionScript and give them a classname, let's say "MyClass".Then I go and write a specialized MyClass.as for it, like this:
public class MyClass extends MovieClip{
private var _button1:Button;
private var _button2:Button;
[code]....
(ps: i know that i wouldn't have to assign the values to the private variables _button1 and _button2 and instead could directly make calls to btn1, but I like to use only Typesafe variables in my code)
This works very well in Flash IDE. when I create a new instance of MyClass() it will contain all the elements that i positioned in the Flash IDE when defining the Symbol. This is very convenient and straight forward.
Now I want to do the same in FlashBuilder.For this i designed the MyClass Symbol as before in Flash IDE, gave it the classname MyClass and then select the library symbol and export it to MyClass.SWC
In Flash Builder i add MyClass.SWC to the buildpath and I write a MyClass.as with the same code as in the Flash IDE example. but this time, the code won't work. on
_button1 = this["btn1"];
i will get an Error #1069 stating that "btn1" was not defined.So - how to do this properly if developing with Flash Builder? PS: i use the default package in Flash IDE when setting the Classname for the symbol as well as in FlashBuilder for the as file.
View 1 Replies
Aug 5, 2004
Why I am losing scope on an array that i define as a private member in a class? I am able to access it from a couple of different functions but in one place inparticular it keeps coming up "undefined". What causes scope to be lost in a function for an array that is defined as a private class member?
View 4 Replies
Apr 9, 2010
for example i have 2 movie clip, clip1 and clip2, and i want to play one of them, which defined in a external txt file variable like this:&c=1& or &c=2&my problem is, i have just one frame to make this!i tride to make simple my question, it's a bigger project!there is more than 2 movies and can't use if(), i just want to change the number of end of movie clip instans name some thing like this:
ActionScript Code:
clipname= "clip"
var trc = new loadVars()
[code]....
View 9 Replies
May 12, 2011
I have a class file defined in my package as MyGlobals.as.[code] (I have tried adding/removing "static" and "dynamic" to no effect.)I am trying to call a touch event from the main timeline in this way:myObject.addEventListener(TouchEvent.TOUCH_BEGIN, MyGlobals.myFunctionName);(I have tried removing the class name to no effect.)When I compile I get the error 1046: Type was not found or was not a compile-time constant: TouchEvent. This error occurs on function definitions in the class file.What syntax/concept am I getting wrong? The functions were working fine when I was using constants in the timeline, but I need to be able to reuse these functions over and over again, so I wanted them to be able to take touch event variables so that I didn't have to write a different function for every touch event.I tried googling "error 1046" but I can't find anything useful.
View 3 Replies
Mar 3, 2012
I want to make a little game. What I need is to add event listeners to all of Tank objects inside the Battlefield instance. I just can seem to figure out how.
View 1 Replies
Mar 25, 2010
I have a label component in a mxml file like below
<mx:Label x="700" y="409" text="Label" id="lble" width="131" height="41"/>
if i want to access it and change its text content within a method defined in action script class that i have written, how to do it?
lble.text="test";
View 2 Replies
Jul 10, 2009
I am trying to use the CSVLib from [URL].. However; when trying to use one of the examples I get an "1180: Call to a possibly undefined method addFrameScript."This is what I did.Extracted the files, then moved all FLA, AS and CSV files in the root (where also the COM folder resides). Then added the import statement to the Applicaiton file and defined document class.
View 2 Replies
Mar 25, 2010
I have a Main.fla which loads Main.as as its document class. In Main.as I have a public function named "Main" which runs a trace. I also have another .as file called Preloader.as, which also has a public function in it, this one named "Preloader" with simple trace in it. I just cannot figure out how to use Preloader() from the Preloader class in Main() from the Main class. Main.as loads up fine when the SWF loads and traces.
View 10 Replies
May 27, 2009
is it possible to trace/get a variable that's defined in a "main" .swf, from an external SWF that has been loaded onto the "main" SWF?
for example, if i have 2 SWF files called "main.swf" and "sub_page.swf"..
the code in "main.swf" is:
Code: Select all // create and define a variable
var currentInformation:String;
[code]...
i tried putting "Object(root)" before "currentInformation" and it still wont work...
View 2 Replies
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
Oct 22, 2011
I am trying to access a function in a loaded swf that has external class.. I would like to avoid having to put the function on my "Main" Doc class in the external swf and instead access the function directly from the class
This is what ive tried so far and it's a no dice:
private function startLoad(){
var loader:Loader = new Loader();
var req:URLRequest = new URLRequest("one.swf");
[Code]....
View 1 Replies
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