[as3] button delay issue

Hi,

i have an issue with my code :

boutonPoussoir.addEventListener(ButtonEvent.PRESS,boutonPresser)
boutonPoussoir.addEventListener(ButtonEvent.RELEASE,boutonRelacher)

pretty simple, i'm using that to detect if i press the button, it turn a led on and off... it work but with weird delay... betwen 2s and 10s... always random :s

when i'm using a movieClip as a button to trigger the led, it works without any delay... same thing with the potentiometer i put... any ideas ?

thanx

I've heard of keyhole surgery, but never keyhole debugging.

i don’t understand (yeah, sorry, english is not my first language). whatever, i can translate you sentence, but not giving it any meaning related to my question :frowning:

Post your code.

sorry, here it is

package {
    import flash.display.Sprite;

    import funnel.*;
    import funnel.gui.*;
    import funnel.ui.*;
    import flash.events.MouseEvent;
    import flash.events.Event;
    import com.greensock.*;
    import com.greensock.easing.*;
    import com.greensock.TimelineMax;

    
    public class ArduinoTest extends Sprite {
        // Arduino
        private var arduino:Arduino;

        // LED
        private var led:LED;
        private var ledActive:Boolean=false


        // Bouton poussoir
        private var boutonPoussoir:Button;

        //potentiometre
        private var potentiometre:Potentiometer;
        private var equation:int
        private var sizeMin:int=30
        private var sizeMax:int=50

        public function ArduinoTest() {
            // LED
            var config:Configuration = Arduino.FIRMATA;
            config.setDigitalPinMode(3, OUT);
            config.setDigitalPinMode(7, IN);


            arduino = new Arduino(config);

            // Arduino
            arduino.addEventListener(FunnelEvent.READY, onReady);

            
            // LED
            led = new LED(arduino.digitalPin(3));
            boutonPoussoir = new Button(arduino.digitalPin(7),0,20);
            potentiometre = new Potentiometer(arduino.analogPin(1))
        }


        // Arduino
        private function onReady(e:FunnelEvent):void {
            // LED
            bouton_mc.addEventListener(MouseEvent.MOUSE_DOWN,ledBlink)
            bouton_mc.buttonMode=true

            //boutonPoussoir.addEventListener(ButtonEvent.PRESS,boutonPresser)
            boutonPoussoir.addEventListener(ButtonEvent.RELEASE,boutonRelacher)
            boutonPoussoir.addEventListener(ButtonEvent.LONG_PRESS,boutonPresser)

            TweenMax.to(marqueurSize_mc,0.1, {height:equation,width:equation,alpha:1,ease:Quad.easeOut});
            potentiometre.addEventListener(CHANGE,potoBouge)
                                           

        }
        private function potoBouge (e:Event) {

            equation=((potentiometre.value)*sizeMax)+sizeMin;
            TweenMax.to(marqueurSize_mc,0.1, {height:equation,width:equation,ease:Quad.easeOut});


        }

        private function boutonPresser (e:ButtonEvent) {
            trace("led on")
            led.on()
        }
        private function boutonRelacher(e:ButtonEvent){
            trace("led off")
            led.off()
        }


      private function ledBlink (e:MouseEvent) {

            if (ledActive) {
                led.on();
            }else{
                led.off();
            }
            ledActive=!ledActive;
        }


    }


}

I'm nearly certain that that won't compile using the Arduino IDE.

it's action script 3 + funnel sdk.. and it compiles pretty well. everything is working, even this button, but the delay os really weird (and make ma project not usable at all)

do you think it's an hardware problem ? (i'm better in action script than in hardware stuff..., i'm really a newbie)

    import funnel.*;

This compiles on the Arduino? I don't believe that.

Post your Arduino code. That's what you are here for help with.

If you needed help with the action script stuff, you'd have gone to an action script forum, wouldn't you?

I don't put any code at all in the arduino. It's just a standartfirmata 2.2

The whole point of using the funnel sdk, is that i don't need to bother about arduino (i don't know the first thing about arduino development)

And i don't need to go to an actionscript forum, my code is working, it compiles, but i'm guessing i made some kind of mistake with the funnel sdk or the hardware...

By the way : import funnel.* in action script, basicaly create a bridge to every libraries of the funnel sdk, without that, i won't be able to start communicating with the arduino board... It's like trying to go inside an house without building a door first...

it seems to work when i'm using analog pin to plug my button instead of digital pin.

i still have a delay, but it doesn't really matter (it's definitely an hardware delay now, the output text in flash works perfectly when i push on or off)...

still, if someone have any clue about the delay, i'm curious why (and also, if i'm doing something wrong, i'd like to learn..), here's some pictures of the hardware :

large view : http://www.creaktif.com/arduino/photo%201.JPG zoom : http://www.creaktif.com/arduino/photo%202.JPG (yellow wire = button, green wires for the potentiometer

thanx