ActionScript 3.0 :: Interface And AddEventListeners?
Aug 13, 2009I have a polymorphic situation that is thus...
Code:
private var loadXML :ILoader;
if (!Capabilities._internal) //testing locally
[code]....
I have a polymorphic situation that is thus...
Code:
private var loadXML :ILoader;
if (!Capabilities._internal) //testing locally
[code]....
this a sample code that im currently using...but i need to find a way to do this long script, as short as possible..
btn1.addEventListener(MouseEvent.CLICK, goto1)
btn2.addEventListener(MouseEvent.CLICK, goto2)
btn3.addEventListener(MouseEvent.CLICK, goto3)
[code].....
I'm using this simple code to retrieve a value from a PHP script:
package
{
import flash.display.MovieClip;
[code]....
Don't care about that squares that is inside the functions, I'm just using it as a example.I'd like that both eventlisteners when removed use the same onclick3 function, in the following code they recognize the onclick3 because it is outside of the eventlisteners. So, how can I remove the eventlisteners and both of them use the same onclick3 function?
[code]...
I need both of them to use the same onclick function, and not 2.
The following creates movieclips from XML. Everything worksgreat.One problem however. I need each MC to have it's own mouse event listener anddon't know how to achieve this because I don't have specificinstance names to refer with. I want to update textfields etc, with specific data when a
View 3 RepliesIs it possible to addEventListeners to video objects ?
ActionScript Code:
var vid:Video;
...
[code].......
i have to make a drag and drop thingy in actionscript 3.0. Now we had another actionscript project before and then i had some extra classes but most things i put in the main class and it was all working fine. Someone told me that i put too much in my main class and that i should make more classes like a class for every object you interact with. Dont know if hes right but he acted like he was.
Now back to the problem. I made a main class connected directly to my fla in its properties. Then i made another class for the game itself, cause maybe it needs an intro and other things so i want to separate them in their own classes and start them with the main class. now in the class for the game itself i want to be able to click an object with the mouse. I was just testing with a trace. When i click the object it only traces like 1/20 clicks i make, tryed alot of things, when i put the same code in the main class with stage.addEvent blabla it will respond every time but as soon as i try to put in the class for my game it only responds like 1/20 times i click. Wth?
Now i can put all my code in the main class again and make another 1000 line code with a couple of other small classes but this time i want to do it right so what am i doing wrong? Heres some code too
This is the main class dressUp is the game class, it doesnt do much just define the game class and change the mouse pointer.
EDIT: We work in a project group so another reason i want to make alot classes is so we can work on different classes separately. But i promised to have this done this weekend and there not so good in actionscript either.
ActionScript Code:
package
{
import flash.display.*;
[Code].....
I have created a simple game which is started by a start button in a Movieclip that opens at the beginning using the code :
var splashscreen:MovieClip = new Splash();
splashscreen.x = 0;splashscreen.y = 0;
addChild(splashscreen);
The splashscreen movieClip has its own code :
Play_btn.addEventListener(MouseEvent.CLICK,playgame);
function playgame(e:Event):void{parent.removeChild(this); Play_btn.removeEventListener(MouseEvent.CLICK,playgame)
}
When I run the game the splashscreen does load and then disappears when the Play button is pressed but none of the eventlisteners seem to work. The background moves, the enemy ships fire but I can't move the ship or fire using the keyboard. The game works perfectly well when I don't use the splashscreen at the start.
This is probably something very simple that I just can't seem to get to work. Basically I'm trying to use a variable to be called inside of an array instead of the actual array so a simple example would be
Code:
var people:Array = [john,tom,ann];
var selected = john;
trace(people[selected]);
I get an error everytime I try to use a variable in place of and actual element
[Code]...
i seem to have trouble finding on the internet what happends when one interface extends another interface.
View 2 RepliesI'm creating a drop down menu and when I addEventListeners to check the clicks on the invisible buttons on frame 19 of the "menu" movieclip, it gives me an error. T really hate doing rollover with actionscripts. The download link for the fla can be found in below. Sorry for posting an external download link as the file is 7mb+! [URL]
View 2 RepliesI'm trying to publish a swf with Flash CS3.
I have one .fla file and two .as files. I think my problem is I don't know how to set the path for the action scripts. All three files are in the same directory
The files:
dtd.fla
TransformItem.as
TransformManager.as
The error: The class or interface 'gs.TransformManager' could not be loaded.
dtd.fla code appears to have an appropriate import: import gs.TransformManager; var manager_obj = new TransformManager([], onTransformEvent, true, false, false, false, false, true, true);
TransformManager.as code appears to have an appropriate import: import gs.TransformItem;
I am an actionscript newbie but have been given the task of designing a navigation menu in flash that has to connect to a database - the menu items have to be marked - unread, mandatory etc. and have to pull back database information to display then be marked as read.
View 3 RepliesI am confuse when to use interface and overidden.
View 2 RepliesI don't need to stream anything. Just wanting to look at a webcam using Flash. Hopefully be able to control (zoom) a Logitech cam on Mac os 10.6+.
It will be a screen I share in Connect. The video pod in connect is not what I want.
Im testing a program in FlashDevelop, which uses Flash player 10. Need externalInterface to work, but on running this simple test program, it displays "ExternalInterface is not available". How do I get ExternalInterface working? [URL]
<mx:Script>
<![CDATA[
import mx.controls.Alert;
private function init():void {
if (ExternalInterface.available) {
[Code] .....
By the way, this script shows "External Interface is available" when I run it in my browser. Its only when I run it in Flash Player 10, that it is not available.
I've created simple swf with interface:
public class Test extends MovieClip implements ITest
{
public function Test()
{
[Code]....
So if I have test.swf in the same directory(local way) it work's fine. But if I'm placing it on the dedicated server: (event.target.content as ITest) returns null. However, I can access speak() without interface like this event.target.content.speak("a!");
I've got a SWF with buttons that are calling a javascript function using External Interface - specifically the Milkbox photo gallery. For various reasons, the page with the embedded SWF has to work online as well as being run from someones local machine. The online version runs fine on every OS/browser. However, I've run into a snag where, for some reason, the local version isn't firing the javascript on Win XP in any browser.Is there perhaps some snag with using External Interface locally on an XP machine, or is there something else at play here? FYI, no problems at all on Vista/any browser.
View 1 RepliesI use interfaces a lot and this seems to be a glaring omission. Makes it impossible to write interfaces for display objects. Anyone know why?
View 14 RepliesI have an object in the library that is linked with class Myclass, I define MyClass in its own AS file and everything runs ok, but as soon as I remove the linkage of the object with the class the compiler generates an error with a seemingly totally different class, that class is part of an open source data structure library for AS3, unrelated to that library object or class MyClass.
The error code is 1044: Interface method ****** in namespace ******* not implemented by class ********.And of course I checked and the class implements the interface methods, all of them so there should be no errors.The library I'm using is a [URL] and the class reporting errors is HashMap and HashTable.
how can I increase the size of flash CS4 interface? Meaning also to enlarge tools buttons, so they are easier to see. I have to strain my eyes, because all of the toolbars and text related to them are too small, for constant work.Is this possible? I know there is one way - to increase display DPI settings, but that would also increase the whole desktop, but I would like just to increase flash interface text size and if it is possible then also tool buttons.
View 1 Replieshow to go about searching for this since I don't know the terms used for it. I am trying to make an interface to use on a website that would have to pull up images and text with no preloading. Think of an online encyclopedia; you put in a word and it pulls up the object/animal/etc with a description. I am looking at needing to pull up thousands of different things; hence the no preloading.
View 2 RepliesI am creating a Mac cd rom with a flash interface and want to open folders on the cd by clicking a button on the interface. I read the this can be done using a bit of applescript but I'm having trouble executing the applescript from flash, I have save the applescipt as an app and when I run it I independently it works fine but when I try to run it using FScommand from flash no joy?
This is the action I'm using on my button:
on (release) {
fscommand("exec", "test.app");
}
I have also created a folder in the root of my cd called 'fscommand' and put my script app in there but still it wont work?
I'm having a problem with Flash and Internet Explorer. I'm trying to close out a browser window with
//as code ExternalInterface.call("closeWindow");[URL].. Of course this works in all other browsers except IE, the error that I am getting is:'null' is null or not an object
i am new to the actionscript 3 . i want to create Phone book for me
i want to use front end as flash interface Back end as Ms excel or Ms access or any databases
I'm doing a simple link code. I've tried many diferrent ways to do this but this error keeps comming up saying The class or interface could not be loaded...
home_btn.addEventListener(MouseEvent.CLICK, gotoURL);
function gotoURL(event:MouseEvent):Void{
navigateToURL(new URLRequest("my site"));}
This is the most recent method I've tried in doing this. I've tried changing the publishing settings of the document to and from Action Script 3.0- using an import command. But thats too complicated.
Attachments: Flashfla.fla.zip (767.8 K)
I would like to have a flash app on a website where:A user can input some values Those values are then sent to a server which has an executable fileThe exe is run with the user's settings and then sends some data back to the userThe data is displayed in the flash app.Is it doable with CGI or is there a better alternative to this?
View 2 RepliesI was studying about EventDispatcher and tried to make my own class and interface IEventDispatcher.Then later i was wondering, what use does the interface have anyway when you still have to declare the functions that are in the interface to the class that implements the interface? The dispatcher will still work without the interface. Like addEventListener, removeEventListener, these functions are within EventDispatcher so why do i need an IEventDispatcher?
View 3 Replieswhen i publish in flash in html, in the Mozilla browser i am getting it in the left but i want it into centre.
View 7 RepliesI have created a peelback advert that peels down from the top right. All is well apart from it it obstructs the user ability of the site underneath as the peelback advert is effectively over the top. I have been giving some guidlines to stop this but i am struggling to understand them. The instructions specificall say that the file must be set with the transparent parameter.
Here are the options that i have:
OPTION 1:
import flash.external.ExternalInterface;
// Function executed in answer to the event
function onClic(pEvt:Event):void {
[code]...
I think it could be the latter two that i need but am not entirely sure, i have tried them but have failed in my attempts?!If this is definetly the way to do it i will persevere! If these are not the way, what does the corner_show/hide method method do?