ActionScript 3.0 :: Why Stage.addEventListener Does Not Respond When On Capture Phase
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
Similar Posts:
Jan 10, 2010
Scenario, you have a MC with a nested MC, and that MC has a nested MC. So mc1 contains mc2, and mc2 contains mc3. Pretty simple.I add an event listener to the top most mc (mc1) for a MouseEvent.MOUSE_OVER (that bubbles, unlike ROLL_OVER). Is there a way to get every item that the capture phase moves through?For example, rolling over mc3 fires the event with the target being mc3 and currentTarget being mc1 (as thats where the listener was added). But I want to know about mc2 being rolled over rather than mc3, and because technically mc2 is being rolled over because it contains mc3.I am using this at the moment to traverse back up the list, and check each item. But surely there is a better way.
PHP Code:
mc1.addEventListener(MouseEvent.MOUSE_OVER, f);function f(e:MouseEvent):void { var t:Object = e.target; do switch(t.name) case"mc1": trace("hit mc1");
[code]......
View 7 Replies
Mar 13, 2008
I cannot get a button within an MC on my stage to respond. The MC is 'togglemenu" and the button is 'next_btn'. What am I doing wrong? This is the code:
[Code]....
View 3 Replies
Jan 14, 2010
I would like to create some text on the stage that does not respond to mouse activity. I've found that after adding a piece of text to a class I am using to draw, it covers up some of the mousing area of my class and disables the user from being able to roll over the other graphical elements...
Is there something like:
var t:TextField = new TextField();
t.text = "hello";
t.active = false; //
i know that this is wrong, but I haven't found an equivalent method
View 1 Replies
Oct 8, 2009
The situation: - some radio buttons on the stage (design time, flash GUI) - A quiz class What I want: - create a RadioButtonsGroup in the quiz class (not with the flash GUI) - assign all the radios to that group (radio.group = myGroup) - respond to the CHANGE event It seems not to work. The group gets created (all the radios of that group are indipendent from the others on the stage), but it doesn't respond to the event.
View 1 Replies
Sep 13, 2010
I am trying to add an eventlistener to the stage to respond to a resizing. When doing so i want to keep the relative position of a movieclip-object constant to the upper and leftmost edges, without changing the alignmode of the stage to top left. This can be achieved as shown below - examplified with two classes and reference to fla implied. The problem is now: When supplying the crucial statements with a Math.round, the movieclip-object gets displaced pixelwise with each new resizing:
myMovieClip.x -= Math.round((deltaX / 2));
myMovieClip.y -= Math.round((deltaY / 2));
Whereas the solution without Math.round is rock stable so it doesn't move at all, as it is not supposed to either! Can anyone figure out why? I know it's a luxury-problem, as my use case is solved. The problem is that i don't know why? Shouldn't the use of Math.round just assure the int-value? Such a small issue could easily spoil the whole app! And i fear that i have misunderstood something fundamental in as3, and suddenly become unpleasantly surprised.
[Code]...
View 5 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
Jan 24, 2008
I'm looking for any information anyone may have on ActionScript 3.0 and capturing the area of the stage. I'm not interested in taking a picture of someones desktop, just the stage.
View 10 Replies
Oct 23, 2010
I have done this a million times in AS but not quite getting it in AS3.. maybe my brain is just fried..i have a rectangle_MC that is moving around the stage.. inside that rectanlge_MC i want to constantly redraw the stage, well only the portion of the stage that is covered by the rectangle..o if my rectangle for instance is currently at x:60 and y:80, and its demensions are 200x200, want it to redraw just the ares of the stage that starts a x:60, y:80 and goes to x:260 and y:280..
View 4 Replies
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
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
Mar 15, 2010
I am trying to grab part of stage area using BitmapData and copyPixels method:
bmd = new BitmapData(stage.stageWidth, stage.stageHeight);
bmdRect = new BitmapData(320, 240);
rectangle = new Rectangle(360, 20, 320, 240);
bmdRect.copyPixels(bmd, rectangle, new Point());
[Code].....
The result i get is an empty .jpg I m pretty sure that the error is in the Bitmap procedure and not the saving one...
View 2 Replies
Jun 26, 2010
basically i would like to screen capture a part for the stage. but i got no idea how to do it as i am very new to flash programming.i am using the PNGencoder to do the process, but i cant actually screen capture the position i want. this is tje sniplet of the code for the process. It is taken from a tutorial with some changes, but it is still lacking of the position of the stage i want to screen capture.
private function export():void
{
var bmd:BitmapData = new BitmapData(216.2, 468.29);
[code]....
the code are working properly for now except it captures the point from 0 x axis and 0 y axis. I need it to be like 150 on x axis and 150 on y axis.
View 3 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
Jun 2, 2010
I have a game that allows people to arrange images however they like, but I need a way for users to take a screenshot/image of their design (stage) so it can be emailed. I've found loads of examples that use server side scripts such as php (JPEGEncoder) but this particular program I�m creating is for internal office use only and don�t have access to a server to upload it.
View 3 Replies
Feb 9, 2012
I am working on a project that requires the stage (and everything on it) to be captured, converted to a bitmap and then that data to be posted to another domain. I have looked at the .getPixel method but that creates a ridiculously long string and more often than not, will crash the swf in the browser. How I could possibly approach this. Oh, I need to do this in AS2 too.
View 1 Replies
Mar 2, 2009
what I'm trying to do is allow the user to pick a section of the stage, click, and have the region defined be copied and show up on the other side of the stage. It may be better explained to think of it like a camera game. The player has cross hairs, can move the square (which tracks the mouse) around the stage, and click to capture that square's pixel information, store it to a new movieclip and display it on another area of the stage.
I've found many resources online about capturing BitmapData, including capturing from embedded FLV videos, but I haven't seem to be able to find anyone who has created something like this which captures from a moving region. However, I have seen it done before in a game that is no longer online from PBSkids.org.
Here is what I have so far. Right now, when I click the movieclip loads all white pixel data and I'm not sure why.
[flash=]import flash.display.BitmapData;
import flash.geom.Rectangle;
import flash.geom.Point;
stop();
[Code].....
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
Jan 18, 2009
What code would you use so that when a button on the main menu of a site is clicked, it plays the end of the current movie before bringing up the next?
I have a site where each page is contained in a movie, and each movie has 3 parts.
1. Intro
2. Pause where content is kept on page
3. Outro
When a button is picked to go to a new page, I would like the outro to play before loading the next movie. Is there a way to do this?
View 3 Replies
Jan 6, 2011
I created the following action script named "sketch.as" :
package
{
import flash.display.Sprite;
[code]....
View 7 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
Nov 18, 2009
I have integrated FlexPMD into my pom.xml file but I need to change the phase & goal in which the plugin is run. Currently it runs in the site phase but I need it to run in the test or compile phase. Is this possible?
[Code]...
View 2 Replies
Sep 21, 2009
I have a custom itemRenderer based in the TreeItemRenderer. I would like to include a control depending on the object passed to the renderer; but in the createChildren method the data property is null. How to access data in this phase?
View 1 Replies
May 24, 2010
Made a swf [URL] some viewers see and hear fine but others are having sound and size issues and I need some practical answers. SIZE: I make the Flash stage the size of the original screen capture video of 1024 x 768 and right now it is set to
[Code]...
View 2 Replies
Mar 1, 2012
In AIR/AS3 Flex Mobile for Android project.How can I capture an "image" of whats visible on the view then just save that image as anything like jpg/pdf to the SD card?Basically a screenshot on Android using AS3.
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
Oct 20, 2011
Is it possible to create a display object in AS and take a screenshot of it as ByteArray or whatever without adding it to stage?
View 1 Replies
May 13, 2010
I'm using external XML to set flash vars. Alpha works, but not Visibility. How do I get my swf to respond to visibility?
XML
<?xml version="1.0" encoding="utf-8"?>
<SESSION>
<BGv TITLE="visible true">false</BGv>[code]...
View 2 Replies