ActionScript 3.0 :: Call A DispatchEvent Call From Inside Of A Static Function?
Feb 3, 2009Does anyone know if there is a way to call a dispatchEvent call from inside of a static function?
View 2 RepliesDoes anyone know if there is a way to call a dispatchEvent call from inside of a static function?
View 2 RepliesIf i keep aside the loose coupling advantage of Events, what is the difference in the way of working of
1) Simple function call
2) Dispatching an event
I'm still wondering which method is the best use:
Event Dispatcher:
PHP Code:
package
{
import flash.events.EventDispatcher;
public class Test
[code]....
How can I get the instance of the class to call the dispatchEvent for the postTrace function.
1180: Call to a possibly undefined method dispatchEvent.
Code:
package {
import flash.display.*;
import flash.events.*;
[Code].....
this is the function i want to turn in to a static function. just dont know how to make it a static function and call it from other classes. i think this would have its own file.
[Code]....
Is it possible to call/envoke a public static function from JS? I can't seem to get it working and Im almost certain it cannot but I thought I would ask the community.
View 2 RepliesI'm wondering if its possible in flash to be able to call a static class function via its name as a string. I know for you're usual case you can do this to call the function 'func'
Code:
this["func"]();
func():void
{
trace("I'm a function");
}
However I'm wanting to do this from another static function and in a static function you obviously can't use the 'this' keyword. I've tried just omitting it, or replacing it with the class name but neither work.
I found a lot of tutorials that show how to use getDefinitionByName() to create an instance of a class. Something like the following:
Code:
var classRef:Class = getDefinitionByName("menus.buttons.Icons") as Class;
var iconClassInstance:Icons = new classRef() as Icons;
[code]....
I'm having a problem in flex 3 where if a static const I have defined is used as the parameter to a function call within binding tags I get a "1120: Access of undefined property NodePropertyMatrix". _propMtx is a ArrayCollection.
[Code]...
public var blob:Blob = new Blob()
addChild.child(blob)
i get this error Call to a possibly undefined method child through a reference with static type Function.
var speed:int = 4;
addEventListener(Event.ENTER_FRAME,MoveRight);
function MoveRight(event:Event):void{
[code]......
how could i call a mc, from inside a function, being this target stored in a var
ex:
var clipVar:MovieClip = this.main_mc.myClip_mc;
function goX (){
this[clipVar]._x = 100;
}
goX();
no parameters for the function?
This is hard to explain, but basically here goes: have a "frame" movieclip that loads images. I call frame.loadImage(the URL) and everything works. So far so good.When I put "frame" inside of another clip, named "frameHolder", then call frameHolder.frame.loadImage, nothing happens.
View 9 RepliesI'm trying to use ExternalInterface.Call to call a JavaScript function to launch a lightbox window. So far I have this:
AS3:
flash.external.ExternalInterface.call("launchLB", "" + aUrl + "");
JavaScript:
function launchLB(url) {
alert(url);
[Code]....
I get the alert but I can't get the lightbox window to display. When my as code makes the ExternalInterface call I get what looks like a page refresh and a blank browser window.
I have an enterFrame action that I use on a graphic:
[Code]....
Because I want to use the above code more than a few times, I tried to make it a function.
[Code]....
But for some reason the function call does not work when I call it via an action on a graphic where initially the code worked when it was explicitly written and not called as a function.
Code:
onClipEvent (enterFrame) {
fadeOut();
}
why this is not working.I have an application with a new class I just created. The class loads, but will not call it's own internal function.
package com.parkerandkent.components.classic.photogallery {
import caurina.transitions.Tweener;
import flash.display.MovieClip;[code]....
"Test 2" will not fire here.And I get this error message:
CallTag.as , Line 10 1180: Call to a possibly undefined method init.
I need to get a javascript var in my Flash application. I like to be able to just set a variable in the javascript (client constraints) rather than define a function.
Can this be done? I am trying to use the ExternalInterface.call()
AS:
ExternalInterface.call("function(){return window.someVar}", null);
JS:
var someVar = "Test";
This does not work and I suspect it is because the ExternalInterface.call() does not like the anonymous function.
I have a function defined in JavaScript like so:
function fadeBack() {
alert("fadeBack called");
};
I call that function from my Flash file like so:
import flash.external.*;
flash.external.ExternalInterface.call("fadeBack");
This works in both Safari and Chrome, but for some reason Firefox won't ever call the function. Still, I can't figure this out. How can I fix it?
when we write
var obj1=new Object();
var obj2=obj1;
we know obj2 is just a call of obj1, they are the same thing.also, prameters of function are also the calls of the object outside e.g.
var objC=new Object();objC.name = "Jhon";[code].........
it seems that when setting tar to null, the obj outside in the function didn't changeit seem taht everything you do will pass to the real object, but not setting it to null;
my questions: how to make the real object became null with a call?
I'm trying to pass a variable through a function, but I'm getting it's value 0. Here's my code:
thumbLoader.addEventListener(MouseEvent.CLICK, goToCategory);
function goToCategory(e:MouseEvent) {
trace(c);[code]....
this trace gives me value of 0. Normally I would do goToCategory(c) and inside that category I would get it's value, but in this case I'm calling this function with an event, how can that be done?
var c is declared globally, so I'm using it above this code in different place... is there smth like global $c like in PHP.. or there's some other way to do it?!
I've got some problems trying to call a function inside a mc in a class.For example:
Code:
class Foo {
private my_mc:MovieClip;
[code]......
how do you call a function that is inside another movieclip?Do global functions have to be declared on the root? I'm trying to do a very simple thing, take the grid tutorial and apply it as a mask to an image. Everything works ok, now I would like to call the function that makes the grid after the pic has loaded.
So I have on the root:
mc_picholder
mc_boxholder <---This mc contains the function that makes little boxes
I can assign the mc_boxholder as a mask to the mc_picholder and this works fine. Now say I have a function in mc_boxholder called makeboxes(), and I want to call it from the root once a pic has finished loading into mc_picholder.All the functions to make the boxes are inside the mc_boxholder. I've tried declaring makeboxes as global, and calling it from the root, doesn't work.I've tried tried writing from root: mx_boxholder.makeboxes(), doesn't work either.....
have a node that has an asfunction embedded - won't work. if I change the a href to a web page- it works fine. If I try to call a custom function it doesn't call it at all.
View 1 RepliesI have a mailTo: function that needs to be added to a button that sits inside of a movieclip. I put the code inside the actionscript layer in the movieclip.[code]...
View 2 Replies1- i have class and i called its before and its running on runtime. i need to call function inside this class from another class, but without call the first one again, because if i called it, it will run default class function again is this doable ?
2- What super() mean ?
i want to call an external function inside a class. thats the code;
in checkConnectionStatus function,
this[_funcNameForSucceededCon].apply(); doesnt work because "this" is the class, not the Application. How can i reach Application at this time or what can i do?
package myLibrary
{
import air.net.URLMonitor;
import flash.events.Event;
[Code]....
let's say I have 3 functions like this.
ActionScript Code:
function function1(e:event):void{
//code
[Code]....
Can I somehow, stop the enter frame in function 2 with some code in function3? I know that is not the better practice, but in this case is really needful to have a function inside another.
I have an object and would like to call a function from it, which the way I am trying to do it, does not seem to work. Here is what I have:
Code:
private function setTimer():Void
{
[code]......
I have a function at frame 1 (_root). Well, i am trying to call this function from a button, inside a movie clip, but it's not successful..
View 2 Repliesi have some actionscript that makes a
ExternalInterface.call('someFunction');
call.is it possible to reference the html object that made the call to someFunction directly using the ExternalInterface.call call?
Assume that the object that makes the call also has some Callbacks (via ExternalInterface.addCallback) that are accessible via javascript.
Currently:
Actionscript source
ExternalInterface.call("someFunction");
ExternalInterface.addCallback("someCallback",someASfunction);
[code]....