Topic: SWF doesn't respond to mouse down button event (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=31572" title="Pages that link to Topic: SWF doesn&amp;#039;t respond to mouse down button event (Page 1 of 1)" rel="nofollow" >Topic: SWF doesn&#039;t respond to mouse down button event <span class="small">(Page 1 of 1)</span>\

 
Boudga
Maniac (V) Mad Scientist

From: Jacks raging bile duct....
Insane since: Mar 2000

posted posted 01-04-2010 06:11

I have been tasked with removing a couple of sprites from a SWF. I ran the SWF through SOTHINK to decompile it. I now have the action scripts to edit. However, when I recompile the movie after simply removing two sprites the "send" button on this flash movie which is a flash signature app fails to respond in any other way than to display the mouse up/down states of the button.

Here's the code...perhaps someone may catch the issue quickly:

code:
package 
{
    import com.adobe.images.*;
    import com.dynamicflash.util.*;
    import fl.controls.*;
    import fl.events.*;
    import flash.display.*;
    import flash.events.*;
    import flash.net.*;
    import flash.utils.*;

    public class Main extends MovieClip
    {
        private var boo:Boolean = false;
        private var clip:MovieClip;
        private var da_color:Number = 0;
        private var byte_array:ByteArray;
        public var send_btn:Button;
        public var clear_btn:Button;
        private var bitmap_data:BitmapData;

        public function Main()
        {
            init();
            __setProp_send_btn_Scene1_Layer1_0();
            __setProp_clear_btn_Scene1_Layer1_0();
            return;
        }// end function

        private function sendPNG() : void
        {
            var _loc_1:* = this.root.loaderInfo.parameters;
            var _loc_2:* = new URLVariables();
            var _loc_3:* = Base64.encodeByteArray(byte_array);
            _loc_2.png = _loc_3;
            _loc_2.formid = _loc_1.formid;
            _loc_2.formstep = _loc_1.formstep;
            var _loc_4:* = new URLRequest();
            new URLRequest().url = _loc_1.action;
            _loc_4.method = URLRequestMethod.POST;
            _loc_4.data = _loc_2;
            navigateToURL(_loc_4, "_self");
            return;
        }// end function

        private function setBooFalse(event:ColorPickerEvent) : void
        {
            boo = false;
            return;
        }// end function

        private function startDraw(event:MouseEvent) : void
        {
            clip.graphics.moveTo(mouseX, mouseY);
            clip.removeEventListener(Event.ENTER_FRAME, drawing);
            clip.addEventListener(Event.ENTER_FRAME, drawing);
            return;
        }// end function

        private function clear(event:MouseEvent) : void
        {
            removeChild(clip);
            clip = new MovieClip();
            addChild(clip);
            clip.graphics.lineStyle(2, da_color, 1);
            clip.graphics.moveTo(mouseX, mouseY);
            return;
        }// end function

        private function addLoaderListeners(param1:IEventDispatcher) : void
        {
            param1.addEventListener(Event.OPEN, inizio);
            param1.addEventListener(ProgressEvent.PROGRESS, inProgresso);
            param1.addEventListener(Event.COMPLETE, completato);
            param1.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityError);
            return;
        }// end function

        private function init() : void
        {
            stage.frameRate = 31;
            clip = new MovieClip();
            addChild(clip);
            clip.graphics.lineStyle(2, da_color, 1);
            clip.graphics.moveTo(mouseX, mouseY);
            addListeners();
            return;
        }// end function

        private function drawing(event:Event) : void
        {
            if (mouseY < 110 && mouseY > 21 && mouseX > 21 && mouseX < 680)
            {
                clip.graphics.lineTo(mouseX, mouseY);
            }
            return;
        }// end function

        private function stopDraw(event:MouseEvent) : void
        {
            clip.removeEventListener(Event.ENTER_FRAME, drawing);
            return;
        }// end function

        private function setColor(event:ColorPickerEvent) : void
        {
            da_color = event.target.selectedColor;
            clip.graphics.lineStyle(5, da_color, 1);
            return;
        }// end function

        function __setProp_clear_btn_Scene1_Layer1_0()
        {
            try
            {
                clear_btn["componentInspectorSetting"] = true;
            }
            catch (e:Error)
            {
            }
            clear_btn.emphasized = false;
            clear_btn.enabled = true;
            clear_btn.label = "Clear";
            clear_btn.labelPlacement = "right";
            clear_btn.selected = false;
            clear_btn.toggle = false;
            clear_btn.visible = true;
            try
            {
                clear_btn["componentInspectorSetting"] = false;
            }
            catch (e:Error)
            {
            }
            return;
        }// end function

        function __setProp_send_btn_Scene1_Layer1_0()
        {
            try
            {
                send_btn["componentInspectorSetting"] = true;
            }
            catch (e:Error)
            {
            }
            send_btn.emphasized = false;
            send_btn.enabled = true;
            send_btn.label = "Sign Document";
            send_btn.labelPlacement = "right";
            send_btn.selected = false;
            send_btn.toggle = false;
            send_btn.visible = true;
            try
            {
                send_btn["componentInspectorSetting"] = false;
            }
            catch (e:Error)
            {
            }
            return;
        }// end function

        private function addListeners() : void
        {
            stage.addEventListener(MouseEvent.MOUSE_DOWN, startDraw);
            stage.addEventListener(MouseEvent.MOUSE_UP, stopDraw);
            send_btn.addEventListener(MouseEvent.MOUSE_DOWN, go);
            clear_btn.addEventListener(MouseEvent.MOUSE_DOWN, clear);
            return;
        }// end function

        private function setBooTrue(event:ColorPickerEvent) : void
        {
            boo = true;
            return;
        }// end function

        function go(event:MouseEvent) : void
        {
            var _loc_2:PNGEncoder = null;
            if (clip.width > 2 && clip.height > 2)
            {
                bitmap_data = new BitmapData(stage.stageWidth, stage.stageHeight, false, 16777215);
                bitmap_data.draw(clip);
                byte_array = PNGEncoder.encode(bitmap_data);
                sendPNG();
            }
            return;
        }// end function

        private function completato(event:Event) : void
        {
            var _loc_2:* = new URLVariables(event.target.data);
            var _loc_3:* = new URLRequest("http://localhost/signeddocument.php?signature=" + _loc_2.imageurl);
            navigateToURL(_loc_3, "_self");
            return;
        }// end function

        private function securityError(event:SecurityErrorEvent) : void
        {
            trace("Security Errors: " + event + "\n");
            return;
        }// end function

        private function inizio(event:Event) : void
        {
            trace("start");
            return;
        }// end function

        private function inProgresso(event:ProgressEvent) : void
        {
            trace("Loaded Percentage: " + event.bytesLoaded + " Total: " + event.bytesTotal + "\n");
            return;
        }// end function

    }
}



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu