ActionScript 3.0 :: Use External SWF Methods And Functions?
Aug 3, 2011Im going to develop an FLASH App to use an external SWF file as a reference to call its methods & functions.
View 0 RepliesIm going to develop an FLASH App to use an external SWF file as a reference to call its methods & functions.
View 0 RepliesI 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.
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".
View 4 RepliesI'm using flash and the error message "Constructor functions must be instance methods." appears for the following code:
invsibleBtn.addEventListener(MouseEvent.CLICK,onClick);
function onClick(event:MouseEvent):void { navigateToURL(new URLRequest [URL]New to action script coding.
Which of the following is better in terms of performance/effectiveness?
public var a:int = 0;
public function Addition():void {
a += 5;
[code].....
I am trying to link buttons in Flash to placeholders on the time line, but keep getting this error message, any ideas what it means
View 2 Repliesi'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.
View 1 RepliesI keep getting that error when i try to compile and the only script I have in it is this:
[Code]...
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:
[Code]...
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);
That I'd like to be able to do is this:
ActionScript Code:
import sprites.vectorGraphics;
var newSquare = 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");
[code]......
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.
View 1 RepliesHow would I access a loaded in swf files public methods in my main swf.
var temp:ExternalSWFLoader = new ExternalSWFLoader("FX_Ticker.swf");
temp.x=temp.y=0;
Ticker =(Sprite)(temp);
[Code]......
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 am talking about doing something like this: [URL]
from flash by using ExternalInterface probably
its a site about interior design. my job is to add some code to do something. i checked the code and his approach is not so good.. he's coding inside objects and frames at the same time. (ive read many actionscript books and this is a really bad practice). Here's the problem... he wants this to be implemented in the site...1.) in the gallery there is a scrolling thumbnails, he wants this to pause about 4 seconds then it will start to scroll..(ive already fixed this by creating a function interval.
Here is where my problem is...2.) When you click the thumbnail, the enlarged view will pop up.. the enalarged view are external swfs... the client wants that when you click on the thumbnail, the scrolling will stop and the external popup enlarged image will come out...this external swf has an exit button to go back to the main gallery window which is another swf... so the client wants that when you hit exit from the external swf popup window, the scrolling will resume.... im having a hard time figuring this out because i dont know how to call a function from an external swf to the main movie (the gallery page) Ill post the fla of main movie, gallery and a single external swf link of the thumbnail. just click on the first picture that will appear on the gallery
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 Replieshow i should be executing external functions from a .swf loader...here's my loader function:
Code:
on (keyPress "e") {
_root.createEmptyMovieClip("container", 1);[code].......
i can easily load the swf into the frame, but the colors don't change. Playing coloreffects.swf on its own works fine, just not through the loader. I imagine this is because you can't just operate two levels of AS2 at once...
how to access functions on my main SWF file from a loaded SWF file?
View 13 RepliesI was told recently by a Flash developer that I respect that using
include "functions_file.as";
is not the appropriate way to import a list of functions into an AS3, Flash CS5 document.We're not talking about objects and packages, just a list of functions.
I have a doubt about access functions between an MAIN fla and his external Movie.
All I need is to return a variable to the MAIN.fla function as TRUE.[code]...
I've got this external class that I'm loading into a function, it traces. But then I try to use the already loaded class in another function it tells me that I'm trying to access something that's not defined[code]...
View 0 RepliesAll I need is to acess the External Movies functions, variables and the External MAIN TIMELINE to control the loaded content.
How do I do that?
I've traced the content just to give a better idea about my Structure[code]...
I'm a graphic designer trying to muddle through enough AS to create a bilingual site.I start it off by setting a variable, "currentlang" upon clicking either the "english" or "french" button. Like so:
on (release) {
_global.currentlang = 1; //english
_parent.gotoAndStop(3); //action begins on the 3rd frame of main movie
[code]....
This works fine for the clips on the main movie, but what happens when I load in external SWF's. How could I make my function "toggleLanguage" talk to newly loaded clips? On the external clip I'm loading in, I have the following code on the timeline:
if (_global.currentlang == 1) {
this.header.gotoAndPlay(1);
} else if (_global.currentlang == 0) {
this.header.gotoAndPlay(2);
}
This works fine when the new movie loads in, meaning that if my "_global.currentlang" on the container movie is set to French, the loaded SWF will display "Bienvenue" rather than "welcome", and vice versa. The problem arises when I try to toggle the language. It only toggles the language of the clips on the main timeline and not the newly loaded ones.
i am loading in a movie clip from a location online. that much works fine, however, in this external movieclip, it is making a _global function call to some code i have in my main swf which this clip is being loaded into.
[Code]...