Glow effect on touch event on spark button flex mobile 4.5

hi,
i want to create a glow effect not on all the spark button when i touch it but only on the touch area.
can it be done on mobile? how?

anyone? glow effect when touching a button?

Similar Messages

  • Capture a "scrolling" event in spark List (Flex 4)

    after hours trying to find a scroller thumb drag event, i'm left stumped. Is ther any way to dispatch an event when the scrollbar of a List component is scrolling? or even better, to capture the scroll thumb dragStart and dragComplete events? thanks in advance -b

    You could detect when the scroll position of the viewport goes sufficiently below zero and then call your refresh logic from there.
    Here's an example of how to detect scroll position changes:
    http://stackoverflow.com/questions/4390725/flex-4-scroller/4425091#4425091

  • Spark button event record.

    Hi,
    I've the issue about record event in automation framework. A mouse events (double click, click, mouseDown) do not recording method which listen the event, i.e. automationManager.addEventListener(AutomationRecordEvent.RECORD, recordHandler, false, 0, true) but events from keyboard such as SPACE or ENTER is successfull recorded.
    This is snippet of xml environment files with event for spark button:
    <ClassInfo Name="SparkButton" Extends="SparkButtonBase" SupportsTabularData="false">
            <Implementation class="spark.components::Button"/>
            <Events>
                <Event Name="Click"   >
                <Implementation class="flash.events::MouseEvent" Type="click"/>
                    <Property Name="triggerEvent"  DefaultValue="1">
                        <PropertyType Type="Enumeration" Codec="event"/>                  
                    </Property>
                    <Property Name="ctrlKey"  DefaultValue="false">
                      <PropertyType Type="Boolean"/>
                    </Property>
                    <Property Name="altKey"  DefaultValue="false">
                      <PropertyType Type="Boolean"/>
                    </Property>
                    <Property Name="shiftKey"  DefaultValue="false">
                      <PropertyType Type="Boolean"/>
                    </Property>
                </Event>
                <Event Name="TypeSpark" >
                    <Implementation class="flash.events::KeyboardEvent" Type="keyPress"/>
                    <Property Name="keyCode" >
                        <PropertyType Type="String" Codec="keyCode" DefaultValue="ENTER"/>               
                    </Property>  
                </Event>
          </Events>
    </ClassInfo>
    In what may be the cause?
    Thanks.

    The Spark button in this case is not itself toggleable.  You will need to use a ToggleButton.  Spark controls are not the swiss army knives that Flex 3 components were (in order to keep things a bit lighter).
    The new Spark skinnable components control their own state internally and the components themselves in turn set the currentState of their associated skin at runtime.  The current state of the component is not (in general) directly controllable via 'currentState'.
    Regards,
    Corey

  • [iphone] Handling button touch events

    I have a view controller which contains a view which in turn manages 2 subviews that take up the entire scree, think like a playing card, where the 2 subviews simulate the front and back of the same card. When the user taps anywhere on the card, the card flips to show the other side. I have added a button to the card but when I tap within the button, it still triggers the main event to flip the card, not the action associated to the button. How do I make this happen? Thanks

    Wups, hit Enter too fast:
    Here's what I am doing:
    1. Create UIViewController
    2. Add a UIVew subclass instance to it. Can override touchesBegan in this object.
    3. Add a UIWebView subclass instance to UIView as a subview.
    The UIWebView seems to be eating all events silently. I override touchesBegan inside of it, and my printf statement doesn't ever get called, so I am suspecting that touch events are not handled by this class, even though it does inherit from UIView.
    Anyone have any ideas?
    Thanks!
    RC

  • Glow effect on button roll-over

    I am wanting to have my transparent button disply a glow effect outline when the mouse is rolled over the button.  Is this possible and if so, how do I go about it?

    Thanks.
    I have been looking for various solutions on "Da' Google" and it seems most involve perhaps a bit more expertise than I can lay claim to having.  I have seen several which involve writing code of some sort.  I am a fair hand at following instructions, so long as they begin at a reference point I can identify.

  • How do you add outer glow effect to text in Elements 12?

    I've created a layer in Elements 12 that contains some text.  I'd like to add an outer glow effect. 
    This is what I am doing:
    1.  Select layer with text
    2.  Click FX button at bottom of screen
    3.  Click Styles tab
    4.  Select Outer Glow from drop down
    5.  I can see 11 preset option.  The only one that works is called 'Fire' and it is not the style I'm looking for.  I want a simple outline, but none of the other presets have any effect.
    Any help would be appreciated!!  Thanks!
    Jeff

    jeffreys42057005 wrote:
    I've created a layer in Elements 12 that contains some text.  I'd like to add an outer glow effect.
    This is what I am doing:
    1.  Select layer with text
    2.  Click FX button at bottom of screen
    3.  Click Styles tab
    4.  Select Outer Glow from drop down
    5.  I can see 11 preset option.  The only one that works is called 'Fire' and it is not the style I'm looking for.  I want a simple outline, but none of the other presets have any effect.
    Any help would be appreciated!!  Thanks!
    Jeff
    Jeff,.
    You're almost there!
    Try  #4 Outer Glow>Simple. Apply.
    Now on the text layer in the layers palette, there is an f on the right. Double click on the f
    This brings up the Style settings dialog. At the bottom, check "Stroke", and adjust with the sliders to suit.

  • Switching touch events from symbols/classes to the main stage?

    For previous threads:
    http://forums.adobe.com/thread/864057
    http://forums.adobe.com/thread/863566
    http://forums.adobe.com/thread/864262
    http://forums.adobe.com/thread/863597
    Bug ID #2940816
    I have an app that wasn't compiling correctly. I sent the bug to Adobe who responded with a workaround. However, I can't figure out how to make their stated workaround work in my code.
    I have puzzle pieces on the stage. Each is assigned to a separate class. Inside the class I have touch events defining multiple touch events for each piece.
    I have another spot on the stage where, when it is touched, a puzzle piece appears. These are also each linked to a separate class. Inside this class I also have touch events defining multiple touch events for each piece.
    Though it works fine on my computer, it wasn't working on an iPad. Adobe said that I needed to switch the touch events so that they were assigned to the main stage instead of to each individual object.
    However, the code they gave me didn't really make sense in context and I'm confused how to implement it.
    This is the code in the class for each piece that is created when you touch the stage:
            public function GeoPiece(): void {
                if (PuzzleGlobals.currentLevel == "Name") {
                    this.gotoAndStop("wholeName");
                else if (PuzzleGlobals.currentLevel == "Abbrev") {
                    this.gotoAndStop("abbrev");
                else if (PuzzleGlobals.currentLevel == "Shape") {
                    this.gotoAndStop("shape");
                this.addEventListener(TouchEvent.TOUCH_MOVE, geoPieceBegin);
            public function geoPieceBegin (e:TouchEvent): void {
                PuzzleGlobals.pieceActive = true;
                e.target.startTouchDrag(e.touchPointID, false);
                e.target.addEventListener(TouchEvent.TOUCH_END, geoPieceEnd);
                e.target.interactionBegin();
                MovieClip(this.parent.parent).nameDisplay.gotoAndStop(e.target.abbrev);
                PuzzleGlobals.currentPiece = e.target.abbrev;
            public function geoPieceEnd (e:TouchEvent): void {
                PuzzleGlobals.pieceActive = false;
                if (currentObjOver.isLocked == true) {
                    currentObjOver.gotoAndStop ("Lock");
                else {
                    currentObjOver.gotoAndStop ("Out");
                MovieClip(this.parent.parent).nameDisplay.gotoAndStop(PuzzleGlobals.chosenPuzzle);
                e.target.stopTouchDrag(e.touchPointID);
                if (this.dropTarget.parent is GeoPuzzle) {
                    if (GeoPuzzle(this.dropTarget.parent).abbrev == e.target.abbrev) {
                        PuzzleGlobals.statesCompletedUSA++;
                        GeoPuzzle(this.dropTarget.parent).isLocked = true;
                        GeoPuzzle(this.dropTarget.parent).gotoAndStop("Lock");
                        e.target.parent.removeChild(DisplayObject(e.target));
                    else {
                        //play BOOP sound indicated wrong drop;
                if (PuzzleGlobals.statesCompletedUSA == PuzzleGlobals.TOTAL_NUMBER_USA) {
                    //play fireworks game
                else {
                    //do nothing
                e.target.removeEventListener(TouchEvent.TOUCH_END, geoPieceEnd);
            public function interactionBegin () {
                if (this.dropTarget != null && this.dropTarget.parent is GeoPuzzle) { //check to make sure it's over a puzzle piece
                    currentObjOver = GeoPuzzle(this.dropTarget.parent);
                    currentObjOver.gotoAndStop("Over");
                if (lastObjOver != currentObjOver) {
                    if (lastObjOver.isLocked == true) {
                        lastObjOver.gotoAndStop("Lock");
                    else {
                        lastObjOver.gotoAndStop("Out");
                    lastObjOver = currentObjOver;
    This is the code in the class for each piece that's already on the stage:
            public function GeoPuzzle(): void {
                if (this.isLocked == true) {
                    this.gotoAndStop ("Lock");
                if (PuzzleGlobals.pieceActive == true) {
                    this.addEventListener(TouchEvent.TOUCH_BEGIN, geoPuzzleBegin);
            public function geoPuzzleBegin (e:TouchEvent): void {
                e.target.addEventListener(TouchEvent.TOUCH_END, geoPuzzleEnd);
                e.target.gotoAndStop("Over");
                MovieClip(this.parent).nameDisplay.gotoAndStop(e.target.abbrev);
            public function geoPuzzleEnd (e:TouchEvent): void {
                if (e.target.isLocked == false) {
                    e.target.gotoAndStop("Off");
                else if (e.target.isLocked == true) {
                    e.target.gotoAndStop("Lock");
                MovieClip(this.parent).nameDisplay.gotoAndStop(PuzzleGlobals.chosenPuzzle);
                e.target.removeEventListener(TouchEvent.TOUCH_END, geoPuzzleEnd);
    You can see that each piece (whether it's already locked on the stage or movable) reacts differently to different touch events. However, this is the code that Adobe gave me as a workaround:
    this.stage.addEventListener(TouchEvent.TOUCH_BEGIN, onTouchEvent);
    this.stage.addEventListener(TouchEvent.TOUCH_MOVE, onTouchEvent);
    this.stage.addEventListener(TouchEvent.TOUCH_END, onTouchEvent);
    var beginCount:uint=0;
    var moveCount:uint=0;
    var endCount:uint=0;
    function onTouchEvent(event:TouchEvent):void{
         switch (event.type){
              case TouchEvent.TOUCH_BEGIN:
                             trace("BEGIN")
                             beginCount++;
                             square.x = event.stageX;
                             square.y = event.stageY;
                             square.startTouchDrag(event.touchPointID, false);
                             break;
              case TouchEvent.TOUCH_MOVE:
                             trace("MOVE")
                             moveCount++;
                             break;
              case TouchEvent.TOUCH_END:
                             trace("END")
                             endCount++;
                             square.stopTouchDrag(event.touchPointID);
                             break;
         trace("begin: "+beginCount+" move: "+moveCount+" end: "+endCount);
    //     countText.text = "begin: "+beginCount+" move: "+moveCount+" end: "+endCount;
    This doesn't make any sense to me because it seems that it would only work if touching the stage had to react in just a single way. I have multiple pieces that need to each react differently.
    1. The pieces that are locked to the stage need to highlight when touched and display their name.
    2. These pieces also need to keep themselves highlighted and their names displayed when the touch is dragged off of them instead of just removed.
    3. Each piece needs to be created when touching the Puzzle Piece button the stage. As these pieces are dragged, they need to highlight the pieces underneath them and unhighlight them when they are dragged off. They also need to display their own names, and lock into place when they are dragged over the correct piece.
    My questions are:
    1. Why don't touch events work in the compiler?
    2. How can I translate my current working code's touch events to all be directly linked to the stage instead of their objects?
    Thanks so much!
    Amber

    I am going to copy and paste this answer into all of the forums I've asked this question in case some noob like me comes along and needs the answer.
    I found the problem! After 3 months I finally figured out what was wrong and why my app was working in Device Central when exported as Flash 10.1 and not on my iPad when exported as AIR for iOS.
    The problem is that in the Flash runtime, if a line of code returns a bug, the flash runtime says "Error, shmerror, try again next time." So I had one if, else statement that was executing when it wasn't supposed to be - only once, at the very beginning of the program. It was throwing an error. When I exported as Flash, flash didn't care, and still executed the code later when it was supposed to. But Apple won't let their programs crash. So instead of just trying that code again, Apple decided, after the first error was thrown, that it would then COMPLETELY IGNORE that line of code. So the error was in the line where the states would unhighlight themselves. Apple just shut down that line of code, that's why it wouldn't execute properly.
    I ended up changing this line of code
    if (lastObjOver != null && lastObjOver.isLocked == true)
    which threw an error when the piece was FIRST dragged over the puzzle, to to this
    if (lastObjOver.parent != null && lastObjOver.isLocked == true)
    which wouldn't throw the error.
    Problem solved!
    If anyone else is having this problem, I suggest you do what I did. Change all your touch events to mouse events so you can run the program in the adc debugger. That's when I discovered the error being thrown.

  • Test touch events in SWF file?

    I'm sure this is one of those "Oh, press this button in Preferences" type of questions, but I have googled to no avail which makes me think I'm either missing something so simple no one has even bothered saying it or I'm asking the wrong question.
    I am trying to write a simple program, just to practice, that will use touch events for an iPad. I don't have a developer account and so am testing the app on my computer. However, it does nothing. Clicking the mouse on the movie clip does nothing. I even copy and pasted someone else's code so that I was sure it wasn't because I got my syntax wrong. Nothing. Is there a way to test touch events on a computer, or do I have to compile the app and send it to an iPad everytime I want to test the app? Is there no AIR simulator that will simulate touch events using a mouse, as there is with XCode?
    Thanks
    Amber

    http://www.republicofcode.com/
    Check for the latest tutorials on the right hand side for touch events

  • Using glow in Photoshop touch for android?

    Hello, I am very new to Ps Touch. Can someone explain how to use the glow function? Each time I do, i get the message "this filter needs transparent pixels." Not sure what to do, please help.

    Hi,
    the easiest way to understand what a transparent pixel is might be to use the erase tool and remove some pixels.
    You get the same if you create an empty document paint something on it.
    You can then apply the glow effect, you are probably having this problem if you started by importing an image since it fills the complete canvas with pixels.
    thanks,
    Ignacio

  • Titles lose glow effect in Final Cut Pro X

    Im using Final Cut Pro X and when I create a title with the glow feature after a while of editing the feature turns off and you can't make the title glow anymore without creating a new one. Still after you make a new one soon the glow effects eventually turns off but it says it's on.
    The project im working on is an hour long. Also it's had one other glitch where in three clips one to two frames go blank. After I added titles to the clips the frames went back to normal and the others that i didnt want text I added blank titles to fix the frames. Any advise on what I should do?

    In the Timeline position your Playhead at the starting position.
    In the Viewport position the Shape Mask at the starting position.
    In the Inspector click the Add Keyframe button.
    Press Control-V to open the Animation Editor to see your keyframes.
    Move the Playhead and the Shape Mask to a new position.
    In the Inspector click the Add Keyframe button.
    Continue adding keyframes until you have defined the Shape Mask’s movement.
    Regards
    Nolan

  • [Andrd]Touch event won't launch

    Here is my code:
    import flash.events.TouchEvent;
    Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
    camBTN.addEventListener(TouchEvent.TOUCH_TAP, function(e){
            camBTN.tf.text = "touched!";
    Well, the button text won't change, no matter what.
    I'm working on Galaxy S 2.2 Froyo.
    Thanks

    @Joe
    It was my hold AIR 2.5 release (do you remember? You told me to download it for a bug of the las t release). Now with the newest everything works fine.
    Thx!

  • Mouse Event consumption on Button(s)

    Hi,
    I have a base screen (window A) with an OnClick events covering the screen.
    I have a popup window (window B) which can overlay this screen.
    This contains 3 FX Buttons X, Y, Z . The action: function() is coded on each one
    X and Y are OK, Cancel buttons (which close Window B)
    Z launches another popup (Window C ) (again overlaying the middle window) which has again onClick events all over it which closes Window C.
    Problems
    1) If the user clicks on button Z - Window C opens, then immediately closes again (because of the onClick event in window C)
    2) If the user clicks X or Y , Window B closes but then launches the OnClick event on window A
    I have blocksMouse : true all over the place but I can't seem to stop the onClick events triggering...
    Any one can shed a light how to consume the continuing mouseEvent caught(?) by the action: function() on the Button
    Cheers,
    ScottyB

    Ok, I agree and thought that too.
    OK , so this scenario has a little twist to it (as all my seem to have ;-)
    It also involves a call back event in each action().
    One to close the window from the parent window, the other to pass a selected string.
    Neither of which I think are too much to ask and should not affect the idea of mouseClicked consumption.
    Anyway have a look - please give it a run (just incase its my setup - although I am pretty up todate 1.6.0.14)
    I have been moving blocksMouse commanda round so feel free to do so yourself - I do not think it helps in this case.
    Click on the Black Square to start
    Main.fx
    package testbed.test05;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.input.MouseButton;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.paint.Color;
    import javafx.scene.shape.Rectangle;
    import javafx.stage.Stage;
    import java.lang.Void;
    public var group:Group = Group {
        content:[]
    def windowB:WindowB = WindowB {
            translateX: (640 - 200 )/2,
            translateY: (480 - 200)/2
            onClose:function():Void {
                delete windowB from group.content;
            blocksMouse:true
    def editButton:Rectangle = Rectangle {
           translateX: 550
           translateY: 200
            width: 50, height: 50
            fill: Color.BLACK
            blocksMouse: true
            onMousePressed: function( e: MouseEvent ):Void {
                println("Edit Button Pressed...");
                if (e.button == MouseButton.PRIMARY) {
                    insert windowB into group.content;
    public def myStage:Stage = Stage {
        title: "Buttons"
        width: 640
        height: 480
        scene: Scene {
            content: bind [group,editButton]
    var windowA:WindowA;
    function runApplication() {
        windowA =  WindowA    {}
        insert windowA into group.content;
    function run() {
        runApplication();
    }WindowA.fx
    package testbed.test05;
    import javafx.scene.CustomNode;
    import javafx.scene.Group;
    import javafx.scene.input.MouseButton;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.Node;
    import javafx.scene.paint.Color;
    import javafx.scene.shape.Rectangle;
    public class WindowA extends CustomNode {
        var boxfill:Color = Color.GREEN;
        def rect =  Rectangle {
                    width: 640
                    height: 480
                    fill: bind boxfill
        public override function create(): Node {
            return Group {
                content: bind [rect]
                onMouseClicked: function( e: MouseEvent ):Void {
                    if (e.button == MouseButton.PRIMARY) {
                        println("Window A clicked:{id}");
                        boxfill = Color.RED
    }WindowB.fx
    package testbed.test05;
    import javafx.scene.CustomNode;
    import javafx.scene.Group;
    import javafx.scene.Node;
    import javafx.scene.paint.Color;
    import javafx.scene.shape.Rectangle;
    import javafx.scene.effect.DropShadow;
    import javafx.scene.control.Button;
    public class WindowB extends CustomNode {
      public var onClose:function():Void;
      def drop  = DropShadow {
                        offsetX: 3
                        offsetY: 3
                        radius: 20
      def background = Rectangle {
            blocksMouse:true
            width: 200
            height: 200
            fill: Color.BEIGE
            arcHeight:20
            arcWidth:20
            effect: drop
        def imageButton =  Button {
            translateX: 100,
            translateY: 100
            text: "Button Z..."
            action: function() {
                   var windowC: WindowC = WindowC {
                                            onSelection: function(selection:String):Void {
                                                        println(selection);
                                            translateX: (640 - 200 )/2,
                                            translateY: (480 - 200)/2
                insert windowC into Main.group.content;
        def buttonX:Button  = Button {
            blocksMouse:true
            text: "Button X"
            action: function() {
                println("Clicked Button X");
                onClose();
            def buttonY = Button {
            blocksMouse:true
            text: "Button Y"
            action: function() {
                println("Clicked Button Y");
                onClose();
        public override function create(): Node {
            buttonX.translateX = background.width - buttonX.layoutBounds.width - buttonY.layoutBounds.width - (2 * 10);
            buttonY.translateX = background.width - buttonY.layoutBounds.width - (1 * 10);
            buttonX.translateY = background.height - buttonX.layoutBounds.height - (1 * 10);
            buttonY.translateY = background.height - buttonX.layoutBounds.height - (1 * 10);
            return Group {
                content: [background,imageButton,buttonX,buttonY]
    }WindowC.fx
    package testbed.test05;
    import javafx.scene.CustomNode;
    import javafx.scene.Group;
    import javafx.scene.Node;
    import javafx.scene.effect.DropShadow;
    import javafx.scene.paint.Color;
    import javafx.scene.shape.Rectangle;
    import javafx.scene.input.MouseEvent;
    public class WindowC extends CustomNode {
        public var selectedLine:String = null;
        public var onSelection: function(:String):Void;
      def drop  = DropShadow {
                        offsetX: 3
                        offsetY: 3
                        radius: 20
      var clicked:String = "You have clicked inside Window C";
      def background:Rectangle = Rectangle {
            width: 400
            height: 400
            fill: Color.BLUE
            arcHeight:20
            arcWidth:20
            effect: drop
            onMouseClicked: function( e: MouseEvent ):Void {
                onSelection(clicked);
                delete this from Main.group.content;
        public override function create(): Node {
            blocksMouse = true;
            return Group {
                content: [background]
    }

  • UIScrollView - Call Touch Event Methods

    Hello Anybody,
    Design Pattern : I have a view with three buttons at the top of the view and one button at the bottom of the view. I have added an UIScrollView in the full centre part of the view. I have sub-classed an image view to this scrollview. This image view can now be pinch zoomed and can be viewed fully using the scroll view. I have done with these things. (Using Interface Builder)
    This is my requirement: Now i need the touch event to be enabled on this UIImageView. It's because I have to touch anywhere in the imageview and have to add an image button at the corresponding positions on the UIImage View.
    Question : But UIScrollview doesn't detect touchBegin , touchmove methods. What is reason for UIScrollview not detecting touch events and how can i activate touch event on UIScrollView?
    Please anybody help me , Its very urgent .......
    Nalan.

    There is no difference to use CSS or JS to assign some style.
    We havn't DOM-object for this menu
    Therefor we should use some trick like touch event emulation.
    May be i am wrong...

  • Glow effect as part of conditional action

    I have a glow effect that is one of the decision blocks of an advanced action. After the object glows, I would like it to stop glowing and return to it's normal state. Is that possible?

    Hi Jay,
    I guess you are trying ApplyEffect action with "ColorEffect->SetGlow" and verifying in swf output. Please correct me if I am wrong.
    The effects that start with "set" prefix under the "Effects->ColorEffect" category will set the effect permanently. So in your case, glow is not disappearing from the caption.
    Please modify your conditional Advanced Action by changing  "ColorEffect->SetGlow"  as "Filters->Glow".
    Please change the action as ApplyEffect ObjectName Glow
    When you click the button, effect will be applied on the caption and Glow will disappear after sometime. Let us know if it resolves the issue.
    Regards,
    Haridoss

  • Bug fix requires switching touch events from symbols/classes to the main stage?

    Also posted in Mobile Development, I'm still not sure which forum I should be in.
    For previous threads:
    http://forums.adobe.com/thread/864057
    http://forums.adobe.com/thread/863566
    http://forums.adobe.com/thread/864262
    http://forums.adobe.com/thread/863597
    Bug ID #2940816
    I  have an app that wasn't compiling correctly. I sent the bug to Adobe  who responded with a workaround. However, I can't figure out how to make  their stated workaround work in my code.
    I have puzzle  pieces on the stage. Each is assigned to a separate class. Inside the  class I have touch events defining multiple touch events for each piece.
    I  have another spot on the stage where, when it is touched, a puzzle  piece appears. These are also each linked to a separate class. Inside  this class I also have touch events defining multiple touch events for  each piece.
    Though it works fine on my computer, it wasn't  working on an iPad. Adobe said that I needed to switch the touch events  so that they were assigned to the main stage instead of to each  individual object.
    However, the code they gave me didn't really make sense in context and I'm confused how to implement it.
    This is the code in the class for each piece that is created when you touch the stage:
            public function GeoPiece(): void {
                if (PuzzleGlobals.currentLevel == "Name") {
                    this.gotoAndStop("wholeName");
                else if (PuzzleGlobals.currentLevel == "Abbrev") {
                    this.gotoAndStop("abbrev");
                else if (PuzzleGlobals.currentLevel == "Shape") {
                    this.gotoAndStop("shape");
                this.addEventListener(TouchEvent.TOUCH_MOVE, geoPieceBegin);
            public function geoPieceBegin (e:TouchEvent): void {
                PuzzleGlobals.pieceActive = true;
                e.target.startTouchDrag(e.touchPointID, false);
                e.target.addEventListener(TouchEvent.TOUCH_END, geoPieceEnd);
                e.target.interactionBegin();
                MovieClip(this.parent.parent).nameDisplay.gotoAndStop(e.target.abbrev );
                PuzzleGlobals.currentPiece = e.target.abbrev;
            public function geoPieceEnd (e:TouchEvent): void {
                PuzzleGlobals.pieceActive = false;
                if (currentObjOver.isLocked == true) {
                    currentObjOver.gotoAndStop ("Lock");
                else {
                    currentObjOver.gotoAndStop ("Out");
                MovieClip(this.parent.parent).nameDisplay.gotoAndStop(PuzzleGlobals.c hosenPuzzle);
                e.target.stopTouchDrag(e.touchPointID);
                if (this.dropTarget.parent is GeoPuzzle) {
                    if (GeoPuzzle(this.dropTarget.parent).abbrev == e.target.abbrev) {
                        PuzzleGlobals.statesCompletedUSA++;
                        GeoPuzzle(this.dropTarget.parent).isLocked = true;
                        GeoPuzzle(this.dropTarget.parent).gotoAndStop("Lock");
                        e.target.parent.removeChild(DisplayObject(e.target));
                    else {
                        //play BOOP sound indicated wrong drop;
                if (PuzzleGlobals.statesCompletedUSA == PuzzleGlobals.TOTAL_NUMBER_USA) {
                    //play fireworks game
                else {
                    //do nothing
                e.target.removeEventListener(TouchEvent.TOUCH_END, geoPieceEnd);
            public function interactionBegin () {
                 if (this.dropTarget != null && this.dropTarget.parent is  GeoPuzzle) { //check to make sure it's over a puzzle piece
                    currentObjOver = GeoPuzzle(this.dropTarget.parent);
                    currentObjOver.gotoAndStop("Over");
                if (lastObjOver != currentObjOver) {
                    if (lastObjOver.isLocked == true) {
                        lastObjOver.gotoAndStop("Lock");
                    else {
                        lastObjOver.gotoAndStop("Out");
                    lastObjOver = currentObjOver;
    This is the code in the class for each piece that's already on the stage:
            public function GeoPuzzle(): void {
                if (this.isLocked == true) {
                    this.gotoAndStop ("Lock");
                if (PuzzleGlobals.pieceActive == true) {
                    this.addEventListener(TouchEvent.TOUCH_BEGIN, geoPuzzleBegin);
            public function geoPuzzleBegin (e:TouchEvent): void {
                e.target.addEventListener(TouchEvent.TOUCH_END, geoPuzzleEnd);
                e.target.gotoAndStop("Over");
                MovieClip(this.parent).nameDisplay.gotoAndStop(e.target.abbrev);
            public function geoPuzzleEnd (e:TouchEvent): void {
                if (e.target.isLocked == false) {
                    e.target.gotoAndStop("Off");
                else if (e.target.isLocked == true) {
                    e.target.gotoAndStop("Lock");
                MovieClip(this.parent).nameDisplay.gotoAndStop(PuzzleGlobals.chosenPu zzle);
                e.target.removeEventListener(TouchEvent.TOUCH_END, geoPuzzleEnd);
    You  can see that each piece (whether it's already locked on the stage or  movable) reacts differently to different touch events. However, this is  the code that Adobe gave me as a workaround:
    this.stage.addEventListener(TouchEvent.TOUCH_BEGIN, onTouchEvent);
    this.stage.addEventListener(TouchEvent.TOUCH_MOVE, onTouchEvent);
    this.stage.addEventListener(TouchEvent.TOUCH_END, onTouchEvent);
    var beginCount:uint=0;
    var moveCount:uint=0;
    var endCount:uint=0;
    function onTouchEvent(event:TouchEvent):void{
         switch (event.type){
              case TouchEvent.TOUCH_BEGIN:
               &nbs p;           &n bsp; trace("BEGIN")
               &nbs p;           &n bsp; beginCount++;
               &nbs p;           &n bsp; square.x = event.stageX;
               &nbs p;           &n bsp; square.y = event.stageY;
               &nbs p;           &n bsp; square.startTouchDrag(event.touchPointID, false);
               &nbs p;           &n bsp; break;
              case TouchEvent.TOUCH_MOVE:
               &nbs p;           &n bsp; trace("MOVE")
               &nbs p;           &n bsp; moveCount++;
               &nbs p;           &n bsp; break;
              case TouchEvent.TOUCH_END:
               &nbs p;           &n bsp; trace("END")
               &nbs p;           &n bsp; endCount++;
               &nbs p;           &n bsp; square.stopTouchDrag(event.touchPointID);
               &nbs p;           &n bsp; break;
         trace("begin: "+beginCount+" move: "+moveCount+" end: "+endCount);
    //     countText.text = "begin: "+beginCount+" move: "+moveCount+" end: "+endCount;
    This  doesn't make any sense to me because it seems that it would only work  if touching the stage had to react in just a single way. I have multiple  pieces that need to each react differently.
    1. The pieces that are locked to the stage need to highlight when touched and display their name.
    2.  These pieces also need to keep themselves highlighted and their names  displayed when the touch is dragged off of them instead of just removed.
    3.  Each piece needs to be created when touching the Puzzle Piece button  the stage. As these pieces are dragged, they need to highlight the  pieces underneath them and unhighlight them when they are dragged off.  They also need to display their own names, and lock into place when they  are dragged over the correct piece.
    My questions are:
    1. Why don't touch events work in the compiler?
    2. How can I translate my current working code's touch events to all be directly linked to the stage instead of their objects?
    Thanks so much!
    Amber

    Sure!
    I haven't changed much. I've been playing around and I think I know where the problem is coming from now. I just can't figure out how to fix it.
    This it the only code I've modified:
            public function interactionBegin () {
                trace ("Current: " + currentObjOver);
                trace ("Last: " + lastObjOver);
                if (this.dropTarget != null && this.dropTarget.parent is GeoPuzzle) { //check to make sure it's over a puzzle piece
                    currentObjOver = GeoPuzzle(this.dropTarget.parent); //make "currentObjOver" assigned to the puzzle piece the finger is currently touching
                    currentObjOver.gotoAndStop("Over"); //highlight the current piece
                    if (currentObjOver != lastObjOver) { //if your finger moves and you're now touching a different state
                        if (lastObjOver != null && lastObjOver.isLocked == true) { //if the previous state you were touching has been solved
                            lastObjOver.gotoAndStop("Lock"); //lock this state into place
                        else if (lastObjOver != null && lastObjOver.isLocked == false) { //if the previous state you were touching wasn't solved
                            lastObjOver.gotoAndStop("Off"); //unhighlight that state
                        lastObjOver = currentObjOver; //assign the current state to be the last state you were touching
    lastObjOver and currentObjOver are always assigned the same object. I can't figure out why, I've run it line by line but I can't figure out where I'm going wrong.

Maybe you are looking for

  • 7.1.2 Upgrade Issue with 2012 Chevrolet Tahoe

    I upgraded my iPhone 5 to iOS 7.1.2 and now it will not work with my 2012 Tahoe via USB connection.  Vehicle has Bose system with navigation.  Previously the display worked with Spotify and any music apps on the phone.  Phone has been rebooted mutipl

  • Sleep vs. External Display

    I have an external display connected to the minidvi to dvi adapter. When the external display adapter is connected, the laptop will not sleep. Goes to screensaver, but not black-out sleep. When the minidvi adapter is unplugged from the laptop's chass

  • How to Stop Thread Within TestStand

    I am a relative "newbie" to TestStand in this aspect.  I am creating an sequence to generate CAN Bus Traffic in hopes of getting to a more accurate throughput measurement.  The Subsequence I am creating is a designed infinite loop and I am specifying

  • ECC 6. was able to delete records even though it has dependent records ....

    Hi Guyz,   Was able to delete entries from master table even though I have entries in detail table. I defined foreign key in detail table field refering to master table field. I am working on ECC6.0. Does any body got same problem ? Regards, Venkat.

  • ITunes won't open on Mac 10.6.7

    My iTunes 10.2.1 crashes on startup. This is the error message I get: Process: iTunes [1222] Path: /Applications/iTunes.app/Contents/MacOS/iTunes Identifier: com.apple.iTunes Version: ??? (???) Build Info: iTunes-10210101~1 Code Type: X86 (Native) Pa