Flex :: Stage.addEventListener Inside A Package?
Dec 29, 2010
I am trying to do something like this:
package com.clicker{
import flash.display.*;
import flash.events.MouseEvent;
public class Stager extends MovieClip {
[code]....
When I do this:
import com.clicker.*;
var test:Stager = new Stager();
test.clicker();
addChild(test);
View 2 Replies
Similar Posts:
Dec 21, 2009
How do I say an MXML component is inside some package? Well, it's in a different folder... I know how to do it ActionScript... But when I do in MXML I don't declare the package explicitly because I don't know how, and when I call it to my application, it states that The prefix "package" for element "package:Component" is not bound.
View 2 Replies
Oct 13, 2009
This is with Flexbuilder 3.2, Eclipse 3.3.2.I am moving my development environment to a new machine. Actionscript classes that compiled in the old environment now get a compile error:
A file found in a source-path must have an externally visible definition. If a definition in the file is meant to be externally visible, please put the definition in a package.I do declare the package in these classes - I think failure to declare the package is the usual reason for this error.To add to the mystery, many classes in this project compile without errors.
View 1 Replies
Jun 23, 2010
I have a movieclip called "cores" in my stage, and inside it a button called for example "bt01"
My fla loads a class called ApplicationMain, and I want to add a listener to the button bt01 into this ApplicationMain, like
bt01.addEventListener(MouseEvent.CLICK, DoSomething);
When I try to run my code I get this error:
Quote:
TypeError: Error #1009: Cannot access a property or method of.
I already tryed thinks like cores.bt01.addEventListener(MouseEvent.CLICK, DoSomething); but nothink works.
View 6 Replies
Sep 21, 2010
I'm working on tabs that display different carousel type galleries with previous and next buttons. So, I've got a function that is being called by these tabs and is passed an array based on which tab is selected. Inside of that function, I'm adding an eventListener to the previous and next buttons and using a callback function that works based on the number of items in the array that was passed through the function call. I was running into some strange happenings and using trace statements. Here's what I find: The first call to the function works and traces correctly. The second call traces 2 trace statements; the 3rd call traces 3 statements and so forth. So, I'm assuming that each call is adding another event listener to the buttons.
Here's a condensed version of the function in question:
Code:
Select allfunction loadgallery(picArray){
/* Image Loading code here */
var totalPics = picArray.length;
var picNum = 0;
next_button.addEventListener(MouseEvent.CLICK, nextPic);
function nextPic (e:MouseEvent):void{
picNum++;
/* Tween actions here */
trace("picNum: " + picNum); //this traces 1x first time, 2x second, 3x third, etc.
}}
Do I need to remove the event listener from the next_button? If so, what's the best way to do that? Or does someone see something else that I"m overlooking? I tried removing the event listener at the beginning of the function, but failed.
View 3 Replies
Aug 4, 2011
I want to make a clicked function that recognized the item being click
Here is my try, but It didn't work:
package {
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class main extends MovieClip {
[Code]....
I understand that I should set 2 things inside the ClickedF of addEventListener but I really don't know how to do it T_T
View 2 Replies
Mar 1, 2012
I have preloader code in my main FLA, and I load the corresponding preloader (a small file) externally. When I detect that the file is fully loaded, I need to add the listener to the content that I want to "preload".[code]If I use it this way, the loaderInfo listener does not work, but if I add the listener ouside of the handler function, it does.The problem is, I need it to work from within the complete handler, because obviously, the preloaded can show the % completed only after it's loaded...
View 1 Replies
Sep 24, 2009
My Question: AddChild() in Main class work as expected, but not in GoBall class. (Main class refers to GoBall: var go = new GoBall()
[Code]...
View 2 Replies
Jul 3, 2009
I got this weird problem, when i run this code:
Code:
package {
import flash.display.MovieClip;
[Code]....
In Flash Cs3 it acts exactly as i want, the ENTER_FRAME runs and the addObject places numerous sprites on the stage. In the window output i'll see the trace. But when i run this code in Eclipse which is set up to use the Flash Player as output i get the first trace from EDHV_ImageSlider but the traces inside addObject won't show up, the sprites however are generated perfect.
The difference between the eclipse setup and the cs3 setup is the fact that the cs3 setup has a *.fla which calls the *.as package.
View 1 Replies
Jan 14, 2010
I created an FLA file that has a control bar (with play, pause, etc.) that I want to appear only when the mouse is moved onto the stage. When the mouse is moved off the stage, I want it to fade.I used the code below but it seems that the MOUSE_OVER event is only captured when the mouse is moved over some object on the stage. When the mouse is over an unused part of the stage, the event is not fired and the control bar remains invisible.barBg_mc is the name of the control bar in the code below.
Code:
import caurina.transitions.*;
stage.addEventListener(MouseEvent.MOUSE_OVER, event_ControlBar_Show);
stage.addEventListener(MouseEvent.MOUSE_OUT, event_ControlBar_Hide);
[code]....
View 1 Replies
Jul 7, 2010
Okay I'm working on a pretty big project, and the last thing I need to do is get this content to display. Here's my lil problem. So I'm loading buildings, and when clicked on, I'm loading a movieclip from the library that has a slideshow movieclip on the first frame, however this slideshow is packaged externally. This slideshow has a "xmlPath" that is defaulted to a XML file. My question is... what kind of code can I use to control which xml is loaded when loading that packaged slideshow?
[Code]....
View 3 Replies
May 13, 2011
I would like to create a class displaying a button:
Code:
package {
import flash.display.Sprite;
import flash.display.SimpleButton;
import flash.display.MovieClip;
import flash.text.TextField;
[Code] .....
But when I call this from my fla file:
Code:
import AutoHideButton;
var button:AutoHideButton = new AutoHideButton();
no errors are given but nothing is displayed (the same code pasted directly into the timeline works).
View 2 Replies
Jul 18, 2011
I just wanna add an image from my library on the stage and have an event listener on it so when i click on it, it will do something. imgFromMyLib is already set to the image i want from my library.
import flash.display.Bitmap;
import flash.events.*;
import flash.display.Sprite;[code].....
View 2 Replies
Feb 7, 2010
When i call stage.addEventListener from Document Class (i.e. the entry class to the program) it works. But now i have changed the structure to something like: Document Class pulls PlayScreen (which is of type movie clip). In this PlayScreen, i call stage.addEventListener, but it gives me error saying: Cannot access a property or method of a null object reference. so how do i go about it. basically, i want to add a stage event listener for keyboard event.
View 4 Replies
Nov 7, 2010
If I have the following code which adds an event listener to the stage, why does it not respond when the capture parameter is set to true. It works fine when it is set to Target and Bubblig (false). My understanding is that all the phases happen...
[Code].....
View 1 Replies
Jul 29, 2011
What's the difference between calling a method on a stage object and my own object ?
For example:
myCarRectangleShape.addEventListener(Event.ENTER_FRAME, doit);
stage.addEventListener(Event.ENTER_FRAME, doitagain);
Let's suppose I compile the class X that extends Sprite
and myCarRectangleShape is also a sprite object
View 1 Replies
Jul 30, 2009
I have the following in a class and get an error message. CaseStudyQuiz is my constructor method. I want to detect when the mouse moves via the stage.addEventListener.
[Code]...
View 17 Replies
Dec 3, 2009
Is there a way to listen movie clips itself for keyboard events instead of stage.addEventListener ??I work on a project a kind of game and Δ± need mymovie clips on stage rotate with keyboard events such as KEY_DOWN key.code LEFT or RIGHT.I tried to add event listener my MC but it didn't work.If I listen to stage every Movie Clip in my stage start rotation same as the others.What should I do? Here is my codes
[Code].....
View 12 Replies
Oct 4, 2009
how to make my package use stage.stageHeight so I can tell a ball to bounce when it reaches the bottom of the stage. I'm calling my ball to the stage from the library in a way I'm not used to and have never done so I'm assuming it has got to do with that. if you take a moment to look at it (pretty simple i've stripped out everything except for the physics that makes a ball drop and bounce) and let me know why I cant detect the stage.
particle.as file:
[Code]......
View 2 Replies
Jul 2, 2009
I have a symbol called s1 in the library and I also created an instance of it on the stage on the first frame, its name is myS01Before I linked the document to a class (this was for youtube player) I was able to add event listeners, such as mousevents, onto this instance in my actions panel. But, after I linked my document to the external class in a package without a name, I cannot add any code into Actions panel, because it gives me all kinds of weird problems.Instead I am trying to use this symbol and add listeners to it in my external class file (the one linked to the document) with no luck.my external class file looks like:
package { import flash.display.Sprite; import flash.display.Stage; import flash.display.StageAlign; import flash.display.StageScaleMode; import src.com.enefekt.tubeloc.MovieSprite; import src.com.enefekt.tubeloc.event.*;
[code]......
View 3 Replies
Sep 15, 2011
i have this code:
Code:
stage.focus=this;
stage.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyDown);
function handleKeyDown(e:KeyboardEvent) {
trace("click");
[code]...
when i play it in flasplayer go well...if i put the swf in a html page not respond to key event...
View 2 Replies
Dec 18, 2009
I am having troubles passing an x and y argument into a package function that creates a projectile on stage at the tank.gun's x and y.I have attached a zip of the code I am working on.[code]
View 6 Replies
Jan 27, 2010
I'm running into this weird thing with ASDoc. It will only document one package function per package.For example.I have these two functions:
gs.util.printf
gs.util.ftrace
In these files:
gs/util/printf.as
gs/util/ftrace.as
The only function that get's documented in ASDocs is "printf". But I know it can do more than one. As an example, in the livedocs [URL] There are more than one functions documented.
View 2 Replies
Nov 17, 2009
I'm getting the following error with the class below: "The public attribute can only be used inside a package." The line generating the error is this one:
public function autoStart(soundFile:String) {
Code:
package {
import flash.display.*;
import flash.events.*;[code]......
View 9 Replies
Aug 26, 2010
I want to send a html webpage with my application in installation package,is it possible?
View 1 Replies
May 14, 2011
- I have A.fla.
- A.fla includes buttons, movie clips and also B.swf is loaded in A.fla using a LOADER
- i want to access elements in A.fla, from the actionscript codes inside B.fla to modify those movie clips and buttons based on actions going on in B.swf
for instance, lets say there is a button X in A.fla, and there is a button Y in B.fla, B.swf is loaded into A.fla, and I want the button Y to erase button X when clicked.
general question: accessing elements in a stage, through a SWF file loaded into that stage.
View 2 Replies
Dec 19, 2009
I am loading an external swf file using the following code:
//add close button
var reqButton:URLRequest = new URLRequest(btn_close);
var loader2:Loader = new Loader();
[code]....
View 2 Replies
Jun 2, 2010
I've a little problem, I don't really understand if I can use addEventListener more than one time on the same object (and same callback function) if this case can I have a problem of overflow, or simple flex is so smart to not add again in the same stack same function
[Code]...
View 2 Replies
Oct 26, 2011
I'm doing everything by the book (I think), I've reviewed this problem multiple times, but I can't seem to get it fixed. The creationCompleteHandler function is b
[code]....
View 1 Replies
Dec 3, 2006
I have an AS3 class that extends sprite. In the class, I create a bunch of Shape objects and add them to the stage..I'd like to change how they look when the mouse moves over them.If I use addEventListener to one of the Shape objects, the specified function is never called...but when I use addEventListener to the instance itself:
Code:
addEventListener(MouseEvent.MOUSE_OVER,drawHover);
The function is called outside of the boundaries of the shapes, as if the class' stage is larger than the shape objects. That's probably the case, but I can't resize it because (1) I can't access the stage (stage is null) and (2) if I resize the instance's height it shrinks the shape objects as well...
View 7 Replies