I have a main actionscript file import other actionscript files into it to use their function. From the tutorials and training videos I have, other external classes apart from the document class always link to an object in the library or an object in the main.as is an instance of the other class, for example:[code]
The problem is I'm not creating any variables from the external class but only want to use the functions from it. When I test the movie, I get error 1180: Call to a possibly undefined method isPossibleNo, which is inside class ProjectileNo that is imported already.So my question is how I can use external functions without creating a new instance of the external class because they only hold calculation functions.
I've got a project thats getting a bit big, so Im taking the actionscript out into separate as files. I want all the basic functions to be in BasicFunctions.as and the make a library for more specific functions. I find that a lot of people use the import statement but I cant get that to work with a simple Hello World trace, yet the include statement works fine (see attached). I understand that import/include work differently, but which is the better method? If import, then is that heavier to work with. Any rate, what's the best way to organise code when it gets to the 1000+ lines?
Im new to AS3.[code]I have above code in a movieclip which i have Exported as a Class.But when i run it says "Constructor functions must be instance methods".
i'm attaching clips from library using attachMovie. inside those clips are functions. I'd like to call those functions a few lines after instantiating them using 'attachMovie.' It seems that the clip isn't fully loaded because my functions aren't being called. I tried using movieClip.onLoad, but no dice.
I am follwoing a tutorial on linda.com about creating a website in Flash everything was going well until i started trying to copy the action script in the online examples now I keep getting this error message and can't figure out how to get rid of it:
My question deals directly with ActionScript 3, although it could possibly appear in other languages. Consider the global trace function found in AS3. Calling the method requires no imports and is globally available from all classes. class A { public function A() { trace("Hello, A!"); // Hello, A! }}
Now, what if I create my own class method of the same name? In AS3, if I have a class method trace and then make a call to trace elsewhere in my class, the call is made to the class method over the global function. Essentially, I've blocked my ability to call the global trace method. class B { public function B() { trace("Hello, B!"); // no output } public function trace(s:String):void { // do something else. }}
Now, I know the obvious answer is to say, "don't create a class method called trace." But what if I'm unaware of the existence of the global trace function? Or what if I have a desire to "override" or "block" the global function? Is doing so bad programming? Or is this just another example of how AS3 is a poor object oriented language?
Been doing some actionscript magic lately, done a nice interpolator class. The class, whenever an update occurs, calls a previously specified callback function. Normally, setting a variable of funCallback:Function and calling it works fine. However when I wanted to specify an *object's method* as the callback for the interpolator, it apparently called it as if it would be a static method.
And it isn't.What I need to do, simply speaking, is to be able to call an object's public method, having just th object's reference and function name, just like the second variant of setInterval does ( the one having "object, string" as the first two params, not "function").
How do I write my class so it passes all of its functions/methods to the calling movieclip? For example, the following code imports my graphics class and creates a square:
ActionScript Code: import sprites.vectorGraphics; var vGX = new vectorGraphics(); var newSquare = vGX.createVector(this, 'square', 'rectangle', 20, 20, 0xff0000, 1, 0x0000ff, true);
I am being told that this error takes place on Line 3, which is blank. I can not figure out what the problem could possibly be.
package { import flash.display.*; public class toppings extends MovieClip { var inventory:Sweettreat; function toppings() { inventory = new Sweettreat(this); inventory.makeSweettreatItems([MCsprinkles,MCchocolate,MCcaramel,MCnu ts,MCcherry]); } }}
there is an SWF file where we used its methods using JavaScript as an reference in HTML.now we want to make an FLASH app & have an SWF as an component where use all that methods in.since Im new here, I need ur comments how can I do it step-by-step.i know JavaScript but new in ActionScript.I use SWF in my JavaScript asCode:
Code: <script type="text/javascript"> var so = new SWFObject("movie.swf", "mymovie", "200", "100", "8", "#336699");
What are some methods of accessing/loading external SWF's aswell as there variables inside them. I've been using URLrequest and loader methods no luck yet.
I can't access the props and methods of an external AS3 swf after it's loaded by Main.as. Here's a very simplified version of the code for Main.as (the calling swf):
Code: package{ import flash.display.Sprite; import flash.events.Event; import flash.net.URLRequest; import flash.display.Loader; public class Main extends Sprite{ private var imgLoaded:Boolean = false; [Code] .....
My client wants to take all the Flash games on their website and put them on a portable device that's not connected to the internet. I need to make sure that the swfs are completely self contained, in that they do not require the internet to load any swfs or other assets. The client does not have any of the fla's, so my plan is to download the swf and decompile it with Sothink, and then search the AS for these methods:
URLRequest loadMovie loadMovieNum
If the search returns results then I'll assume the game is loading something and that game will not be used. The client doesn't want to put any development time into this, so it either goes on the portable as is or not at all.
I have a flash application using callbacks to javascript functions (eg. when it receives some data over a socket, it'll call a js script which would change the content of a div according to that given data).
Afaik, there is no actual mutual exclusion in javascript so I'm not sure if I can/need to simulate something like :
[code]...
So, the question is, when are those callbacks called ? Are they simply queued to be executed right after the browser finishes its task or are they triggered randomly ?
I`m using flash cs3 for my works , but i have one problem!when i use File=> Import=> Import to Library... or Import to Stage...the flash environment becomes terminated.I changed my flash version to CS4 and I have this problem again.
got a really confusing problem with importing one swf in to another. Both swf's are AS3 but each one is coded differently.I have a main swf which has very basic code in. Essentially its just a moving flv with a couple of buttons what just move the user to a different frame to show a different flv file. As it was so simple I didn't set it up using base classes and didn't do any OOP style code (i.e. using methods etc) as it didn't need it. This works fine.
I have now created a new small SWF which does some functional stuff (won't go in to details as it'll take a while). This was a more complex peice of kit so I used classes, external .as files etc (i.e. the approved OOP style way). This on its own also works great.
and now i want to use this quiz ( the swf file ) in a frame of an application i am working on. I want as soon the user clicks on a button to launch the quiz.
I tried any way found on net for importing external swf but it never works. the buttons of quiz appear in the wrong place of the stage ( at the fla where the swf is loaded in )and nothing else is seen, textfields etc.
I'm in the middle of coding a Flash CS5 file with AS 3.0, and a part of that code has me importing an external .as file I wrote. When published, the SWF works fine - but only when it's in the same directory as the external .as file I imported to begin with. Ideally, I'd like the published SWF to work independently without needing to be packaged with the .as file
Am new to classes and as3, just starting to ge the hang of it, but i not fully, so here is some Q's.Fist of i have a Document class, from it i want to call a function in a separate as file. the only way i know of is to, do an import and then instantiate or go static on it's tookus?
But now i got my hands of some pice of code, that uses separate class files without any trace of import, how do they do this?Also if i want to be able to use all the functions from a separate as file in my document class, just like i do if i extends it, but without extending int, how do we do this? do i always need to go ClassName.function() ? or can we do it like in C++
When I point my code to import an external classes such as:
import flash.display.*;
my understanding is that its referencing something within the flash directory to load up the display classes.
In other instances I create a "com.whatever" directory to store other classes that my code can point to.
Well I was running through the Kirupa tutorial (displaying google maps in flash) and I noticed in the code it says "import [url]..." the swf works just fine but where is it grabbing the google classes from if I didnt create the directory?
In my website I would like to import a external file into the stage .The appearance of this file is an image divided into a grid of 6 rectangles (each one a mcl). What I would like to do is, on mouse over, each mcl could rotate to show its back. The idea is when you click , let's say, Adobe the Adobe logo will appear divided in 6 rectangles and when you go over with the mouse they rotates to show Adobe products.