EventListeners class

Hello All, I am learning ActionScript 3.0 A simple question for you. In my Actions panel. I am trying to get a video feed from the Camera. How do i you use addEventListeners to see if the feed is successfull or unsuccessfull?

copy and paste the code you are using to retrieve the feed.

Similar Messages

  • How to block execution of event listeners

    Hi all,
    JDev version : 11.1.1.6
    My requirement is that I want to block all event listeners like ActionListeners, SelectionListeners, DisclosureListeners, RowDisclosure listeners when the screen is opened in readonly mode.
    I could block ActionListeners by disabling command links and command buttons etc.
    But there's no way to block SelectionListeners, DisclosureListeners, RowDisclosure listeners.
    So Is there any common code which can block all listeners?
    Or is there any EventController or something like that which will allow me to control event execution?

    I would have if it was just one screen.
    There are hundreds of screens.
    Anyways, can't I use any javascript to do this? There are some interfaces like EventListeners , classes like EventConsumer etc. Do none of them provide feature to block event listeners?

  • Handeling EventListeners given from other classes...

    Hello again,
    I got the folloing Problem:
    I've got a Frame-Class, with calls a Class from jPanel, this Panel has a button.
    My Problem is this, Is there a way, to handle the button-event from the Parent-Frame?
    Means this:
    MyPanel mp = new MyPanel();
    this.add(mp);
    // Here to wait for the button event, and do something.
    If anybody has a solution, thx alot.

    don't expose the hour variable at all.
    have a method eg addToHourBy( int hrs )
    Probably a simple questions, but how can I access a
    variable from another class. My exact situation is as
    follows.
    A class called WorldCalender has a variable which is
    defined: public int hour; (the value is given to it
    elsewhere).
    I want to access this variable and increase it by one
    in a subroutine in the class Hour. In this class I
    have put: WorldCalender.hour++; but it doesn't seem to
    work. How should I do it?

  • EventListeners, bindingUtils, garbageCollection and you...

    Hey everyone,
    I hope somewhere can help me with this, because I have been
    running in circles on this. I am developing on a fairly large
    application and have recently noticed that instances of my class
    that have event listeners of data binding tied to them cannot be
    garbage collected. It has led to some fantastically bizarre
    artifacts and some gross memory leaks. Multiple copies of screens
    modifying and accessing the same array collections and such...fun.
    The way I see it, there are three real solutions here...
    1.) dictate that all programmers declare weak references when
    creating event listeners
    2.) create some sort of onDestroy method that kills bindings
    and removes eventlisteners when a child is removed from it's parent
    3.) override the addEventListener method to ensure that weak
    references are made, when people inevitable forget #1!
    My questions are thrice: are those my only options?! Or have
    any of you more experienced folks conquered this situation in a
    more elegant, reliable way? If these are my only options, which is
    the best, in your opinions?
    Thank you very much for any info you can give; I'm relatively
    new to Flex and while I understand the GC's terms and conditions,
    I'm hoping there is some way to avoid a massive rewrite/refactoring
    to make it work with me. Thanks again!
    -=Bill

    "bill.cabral" <[email protected]> wrote in
    message
    news:gdqvng$cav$[email protected]..
    > Hey everyone,
    >
    > I hope somewhere can help me with this, because I have
    been running in
    > circles
    > on this. I am developing on a fairly large application
    and have recently
    > noticed that instances of my class that have event
    listeners of data
    > binding
    > tied to them cannot be garbage collected. It has led to
    some
    > fantastically
    > bizarre artifacts and some gross memory leaks. Multiple
    copies of screens
    > modifying and accessing the same array collections and
    such...fun. The
    > way I
    > see it, there are three real solutions here...
    >
    > 1.) dictate that all programmers declare weak references
    when creating
    > event
    > listeners
    > 2.) create some sort of onDestroy method that kills
    bindings and removes
    > eventlisteners when a child is removed from it's parent
    > 3.) override the addEventListener method to ensure that
    weak references
    > are
    > made, when people inevitable forget #1!
    >
    > My questions are thrice: are those my only options?! Or
    have any of you
    > more
    > experienced folks conquered this situation in a more
    elegant, reliable
    > way? If
    > these are my only options, which is the best, in your
    opinions?
    >
    > Thank you very much for any info you can give; I'm
    relatively new to Flex
    > and
    > while I understand the GC's terms and conditions, I'm
    hoping there is some
    > way
    > to avoid a massive rewrite/refactoring to make it work
    with me. Thanks
    > again!
    There aren't any easy answers, but this might point you in
    the right
    direction:
    http://link.brightcove.com/services/player/bcpid1733261879?bclid=1729365228&bctid=17412126 60
    Keep in mind that any event listeners added within the scope
    of a component
    will be destroyed when the component is destroyed.
    so this.addEventListener=OK
    that.addEventListener=may not be
    HTH;
    Amy

  • Is it possible to pass parameters through eventlisteners?

    Hello everyone!
    Inside a .fla file I have some buttons and each button will tween a different image to the stage. All the images are outside the stage in the same x and y position and I just need to tween the x coordinate.
    Now I'm working with an external document class where I'm trying to hold all my functions and I'm stucked with the Tweens. I'm willing to stay away from the flash tween engine and I'm trying to work with tweenLite.
    My question is: Is it possible to pass parameters through eventListeners so I can use something like this inside my docClass?
         public function animeThis (e:MouseEvent, mc:MovieClip, ep:int):void { //ep stands for endPoint.
         TweenLite.to(mc, 2, {x:ep});
    If this is possible, how am I supposed to write the listeners so it will pass the event to be listened for AND those parameters? And how to build the function so it will receive those parameters and the event?
    If this is not possible, what's the best approach to do this?
    Thanks again!

    So, I understand you need to match buttons with corresponding visuals.
    Here is a suggested approach.
    Since SimpleButton is not a dynamic class, I suggest you have an enhanced base class for these buttons that extends SimpleButton. What is enhanced is that button has reference to the target.
    I wrote code off the top of my head and it may be buggy. But concept is clear:
    This is base class for all the buttons:
    package 
         import flash.display.DisplayObject;
         import flash.display.SimpleButton;
         public class NavButton extends SimpleButton
              public var targetObject:DisplayObject
              public function NavButton()
    Now, this is your doc class that utilizes this new buttons:
    package 
         import flash.display.DisplayObject;
         import flash.display.MovieClip;
         import flash.display.Sprite;
         import flash.events.Event;
         import flash.events.MouseEvent;
         public class DocClass extends Sprite
              private var btnArray:Array;
              private var visuals:Array;
              // references to objects being swapped
              private var visualIn:MovieClip;
              private var visualOut:MovieClip;
              public function DocClass()
                   if (stage) init();
                   else addEventListener(Event.ADDED_TO_STAGE, init);
              private function init(e:Event = null):void
                   removeEventListener(Event.ADDED_TO_STAGE, init);
                   // buttons and MCs shouldn't be in the same array - otherwise it is counterintuitive
                   // assuming all the objects are on stage
                   btnArray = [price_btn, pack_btn, brand_btn, position_btn];
                   visuals = [g19_mc, g16_mc, g09_mc, g04_mc];
                   configObjects();
              private function configObjects():void
                   var currentVisual:MovieClip;
                   var currentButton:NavButton;
                   for (var i:int = 0; i < btnArray.length; i++)
                        currentVisual = visuals[i];
                        // hold original positioin
                        currentVisual.hiddenPosition = currentVisual.x;
                        currentButton = btnArray[i];
                        // set target MC
                        currentButton.targetObject = currentVisual;
                        currentVisual.addEventListener(MouseEvent.CLICK, placeObject);
                        currentButton.addEventListener(MouseEvent.CLICK, placeObject);
              private function placeObject(e:MouseEvent):void
                   // if NavButton is clicked - make new visual targeted for moving in and currently visible object subject for moving out
                   if (e.currentTarget is NavButton) {
                        visualOut = visualIn;
                        visualIn = NavButton(e.currentTarget).targetObject;
                   else {
                        // otherwise - move visual out
                        visualOut = visualIn;
                   swapVisuals();
               * Accompishes visuals swapping
              private function swapVisuals():void {
                   if (visualIn) TweenLite.to(visualIn, .3, { x:0 } );
                   if (visualOut) TweenLite.to(visualOut, .3, { x:visualOut.hiddenPosition } );

  • Is it flash bug? Tween Class

    I've been working on a bit big project. I've some components on the stage. There are basically 4 frames. Each frame has some components. What I've done is, I've used tween class. Workflow is something like this:
    Frame 1:
    --used Tween class to get fade effect for List component.
    --used Tween.MOTION_FINISH event to fire an event when it is finished.
    --when it is finished, applied eventListener
    --on Change event, remove eventListeners and use Tween class again to get reverse fade effect.
    --again used Tween.MOTION_FINISH event to fire an event when finished.
    --in that evenHandler, gotoAndStop(2);
    Frame 2:
    //similar
    Frame 3:
    //similar
    and so on.. now, what happens, is, if i play with my scene, sometimes tween class failed to work. sometimes it does not display List component, sometimes it displays List component with alpha 0.2. sometimes it happens with movieClip also. Is it flash bug or problem with my code?

    probably a coding problem.  the most common error that seems like a flash bug would be to define a tween within a function body allowing flash to gc that tween, possibly before it starts and/or completes.

  • Inheritance problem: base class does not see stage instances

    I'm writing a series of Search windows for an application. I create the FLA files on the stage, each has 3 simple buttons: next_btn, prev_btn, and close_btn. Those all have event listeners which call findNext(), findPrev() and closeWin() respectively. Each search window looks for different things, some with a text box and some with a combo, etc.
    So I have a base class com.search that extends Sprite and adds the eventListeners at startup (actually, on addedToStage). Like this:
    function isAddedToStage(evt:Event){
       next_btn.addEventListener("click",findNext);
       prev_btn.addEventListener("click",findPrev);
       close_btn.addEventListener("click",closeWin);
    Then I write the appropriate find functions in each derived class.
    For example, I have
    package com {
         import com.search;
         class searchText extends search {
    In my FLA file, I set the class to com.searchText.
    But when I compile and run the window, I get runtime errors:
    ReferenceError: Error #1065: Variable next_btn is not defined.
    at com::search()
    at com::searchtext()
    If I add the event listeners in the derived class rather than the base, it works fine. But that seems to defeat the purpose of inheritance, plus it infers that I won't be able to derive new classes/swfs from those derived classes.
    So the question is, how does one reference objects created on the stage from a base class of that document's class?

    Found it. After messing around with trying dynamic classes and overriden functions that returned the desired button (that worked, but was ugly.)
    Simply and silly once you know how.
    You have to explicitly reference the stage objects (or any newly declared methods or properties) in the derived class as members of "this" in the base class - so:
    class Search {
    function isAddedToStage(evt:Event){
       this.next_btn.addEventListener("click",this.findNext);
       this.prev_btn.addEventListener("click",this.findPrev);
       this.close_btn.addEventListener("click",closeWin);
    function closeWin(e:Event){
    and then create the buttons on stage in the FLA using the derived class.
    You can also declare the event handling functions in the base class as empty functions and then override them in the derived classes. Or fill in the functions in the base class to throw a runtime error, and then override - that's as close to an abstract class as you can get, I think.

  • Basic Classes (Part 2)

    I am continuing work with custom classes and OOP. I find that
    I can't get eventlisteners and other actions to work unless I use
    nested functions (which I know are frowned upon). The following
    works correctly but the mouse event listener is an example nested
    functions mentioned above. How can I rewrite this without the
    nested function that executes the mouse listener? Thanks as always.
    package {
    import flash.display.MovieClip;
    import flash.media.Sound;
    import flash.media.SoundChannel;
    import flash.media.SoundMixer;
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.events.MouseEvent;
    public class Index extends MovieClip {
    public function Index() {
    var D:MovieClip = new dMC();
    D.x = 100;
    D.y = 275;
    addChild(D);
    var dtext:MovieClip = new dText();
    dtext.x = 758;
    dtext.y = 384;
    var A:MovieClip = new aMC();
    A.x = 225;
    A.y = 275;
    addChild(A);
    var W:MovieClip = new wMC();
    W.x = 345;
    W.y = 275;
    addChild(W);
    var G:MovieClip = new gMC();
    G.x = 470;
    G.y = 275;
    addChild(G);
    var B:MovieClip = new bMC();
    B.x = 590;
    B.y = 275;
    addChild(B);
    var L:MovieClip = new lMC();
    L.x = 715;
    L.y = 275;
    addChild(L);
    var O:MovieClip = new oMC();
    O.x = 820;
    O.y = 275;
    addChild(O);
    var GG:MovieClip = new ggMC();
    GG.x = 940;
    GG.y = 275;
    addChild(GG);
    var dSoundReq:URLRequest = new URLRequest("
    http://www.clevelandbrowns.cc/audio/dSound.mp3");
    var dSound:Sound = new Sound();
    var dChannel:SoundChannel = new SoundChannel();
    dSound.load(dSoundReq);
    D.addEventListener (MouseEvent.MOUSE_OVER, dRoll);
    function dRoll (evt:MouseEvent):void {
    addChild(dtext);
    } // closes Index function
    } // closes Index class
    } // closes package

    I got the problem: my tag list loaded in the whichCode dropdown by the myReadXMLPreferences function has some items beginning with numerical chars (example: 1ACDE) and they are not allowed as tags (I did not remember this limitation). If I choose an alphabetic first char code from the list the script is working.
    I think I should filter the list putting a string before any numerical code.

  • Lose MouseEvent after creating new class. Why?

    I have a main class that generates three clickable textfields (lessons).  Clicking a specific lesson starts the appropriate lesson.  However, once the lesson starts, I am unable to detect any mouseevents.  I do not use any mouseevents in any of the lessons so I am baffled about what happened to my mouse eventlisteners.  Even though I can see the nextLesson button, nothing happens when clicked.  If I click it before starting my lesson, my trace indicates that I have clicked it.  Any ideas?  Do I need my lessons to somehow self-terminate when done and if so, how would I go about this.  I currently use the browsers back arrow to terminate the complete session.  Seems kludgey.

    Site: itonlytakes1.org
    Currently I only have one lesson published: Discover the first ten number labels.  A minor annoyance is after you click on the lesson text, you have to click on the window again BEFORE the lesson will detect a numeric keypress (don't understand this either).  After executing the forty experiments (around two minutes), a summary of the time it took to recognize (subitize) the dashes and the quantity of errors will display.  I have been unable to create buttons or execute any code that will let you exit this screen and return to the main program screen, hence the advice to use the browser's back arrow.  SO, I decided to create a higher level script that contains all the lessons instead of using HTML, but I have not published it because I can't get the mouseevent to occur after starting Labeling.  I'll attach my prototype main program, Discovery, and the first lesson, Labeling (which is currently executed when you click on "Discover the first ten number labels".)  Be kind as I only started using AS3 and O.O.P. in January.  Thirty years ago I programmed in Fortran IV, and I haven't even written a shell script for 15 years.
    *********** don't know why .as files aren't attachable **********
    *********Discovery.as********************************
    package subquan{
        import flash.display.Sprite;
        import flash.text.*;
        //import flash.ui.Keyboard;
        import flash.events.*;
        //import flash.utils.setInterval;
        //import flash.utils.clearInterval;
        //import flash.utils.getTimer;
        public class Discovery extends Sprite {
            var lesson:*;
            public function Discovery() {
                var labeling:TextField = new TextField;
                labeling.text = "Discover number labels";
                labeling.x = 20;
                labeling.y = 50;
                addChild(labeling);
                labeling.addEventListener(MouseEvent.CLICK, runLabeling);
                var container:TextField = new TextField;
                container.text = "Discover number labels";
                container.x = 20;
                container.y = 100;
                addChild(container);
                container.addEventListener(MouseEvent.CLICK, runContainer);
                var dimension:TextField = new TextField;
                dimension.text = "Discover number labels";
                dimension.x = 20;
                dimension.y = 150;
                addChild(dimension);
                dimension.addEventListener(MouseEvent.CLICK, runDimension);
                private function runLabeling(evt:MouseEvent):void {
                lesson = new Labeling();
                addChild(lesson);
                private function runContainer(evt:MouseEvent):void {
                trace("Containers clicked");
                private function runDimension(evt:MouseEvent):void {
                trace("Dimension clicked");
    ********************  Labeling.as ***************************************
    package subquan{
        import flash.display.Sprite;
        import flash.display.Shape;
        import flash.text.*;
        import flash.ui.Keyboard;
        import flash.events.*;
        import flash.utils.setInterval;
        import flash.utils.clearInterval;
        import flash.utils.getTimer;
        public class Labeling extends Sprite {
            public static  const UP:Boolean=true;
            public static  const DOWN:Boolean=false;
            public static  const OFF:Boolean=false;
            public static  const ON:Boolean=true;
            public var number:*;// Main Container for all
            public var questions:*;// Remaining questions container
            public var rightEdge:uint;// Set in .fla file through window->property and select top pointer in side menu.
            public var lowerEdge:uint;
            // Decimal point locates number on the stage. (Not always visible)
            public var decimalPointX:uint;
            public var decimalPointY:uint;
            public var dim:String;
            public var base:uint;// Maximum pairs (base, number) = (2, 127), (3, 2186), (4, 16383), ..., Math.pow(base, 7) - 1
            public var num:int;// Maximum number is seven(7) digits regardless of base.
            public var scale:uint;
            // Variables for smooth scaling
            public var smoothStep:Number;// Change in scale for each step
            public var normalization:Number;// Current level of normalization.  Usually at 0, stop, or 1
            private var normalizationStop:Number;// Intermediate stop between full and normalized.
            private var smoothIntervalID:int;// Used to clear smoothing interval
            private var atAStop:Boolean=true;// smooth scaling is completed
            // Shared text field shows message whether subquan is to scale or not.
            private var answered:Boolean=false;// Indicates whether correct answer received
            private var answerSoFar:String;
            private var answerSign:Boolean;
            private var subquanAnswer:String;
            private var subquanAnswerSign:Boolean;
            private var waitAfterAnswer:uint;
            private var grade:Boolean;
            private var range:uint;
            private var hintID:int;
            private var sleepID:int;
            private var sounds:*;// Instance name for DigiSounds
            // Normalization text
            private var ToScale:String = "Subquan to scale";
            private var NotToScale:String = "Subquan NOT to scale";
            private var Normalized:String="Subquan normalized";
            private var lesson:*;// LessonText object
            private var answerArray:Array;
            private var samples:uint;// Number of samples of each digit
            private var numberTimes:Array=new Array();//Array keeping tracking of times per digit
            private var checkTime:Number;//Used for computed the time to answer
            private var errors:Array=new Array();//Tracks the number of errors.  Used to compute average time to answer
            private var newLesson:Boolean;//Tracks the start of a new lesson
            private var iterations:uint;//Total number of answers required = base * samples
            public function Labeling() {
                newLesson = true;
                base = 10;
                samples = 4;
                iterations = base * samples;
                for (var i:uint=0; i<base; i++) {
                    numberTimes[i] = 0;
                    errors[i] = 0;
                var numbers:*=new Numbers();
                answerArray = numbers.getNumbers(samples, base);
                rightEdge=550;// Set in .fla file through window->property and select top pointer in side menu.
                lowerEdge=400;
                decimalPointX=rightEdge - 100;
                decimalPointY=lowerEdge - 50;
                range=1;// Power of 10.  Do not exceed 7!
                waitAfterAnswer = 3000;
                smoothStep = 1/24;// Change in scale for each step
                sounds=new DigiSounds  ;// Initialize array of number words and notes
                lesson = new LessonText(lowerEdge, rightEdge);// Initialize feedback texts
                addChild(lesson);
                lesson.intro.text = "DISCOVERY 1:\n\nYou can recognize, in less than one second, any\nlabel (or symbolic name) of the first ten digits\n\nDo not count\nEnter 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9\nas fast as you can\n\nEnter any number to begin.";
                lesson.remainingLabel.text = "Remaining experiments";
                addEventListener(KeyboardEvent.KEY_DOWN,keyDownFunc);
            private function newNumber():void {
                if (number) {
                    stage.removeChild(number);
                if (answerArray.length>0) {
                    num = answerArray.pop();
                    setNormalization(1);
                    // TEMPLATE: Quantity(num:Number, newBase:Number, normalization:Number=1, scale:Number=1, dim:String="null")
                    number=new Quantity(num,base,normalization,1, "null", OFF);
                    stage.addChild(number);
                    checkTime=getTimer();// Set time when number was displayed
                    number.x=decimalPointX;
                    number.y=decimalPointY;
                    subquanAnswer=String(number.getSubquanNumber());
                    subquanAnswerSign=number.getSubquanSign();
                    sounds.playNumber(subquanAnswerSign,number.getSubquanNumber());
                    lesson.answer.text="";
                    answerSoFar="";
                    answerSign=true;
                    lesson.grade.text="";
                    grade=false;
                    lesson.hint.text="";
                    clearInterval(hintID);
                    hintID=setInterval(giveHint,5000);
                    answered=false;
                } else {
                    lesson.grade.text="";
                    lesson.answer.text = "";
                    lesson.scaleText.text = "";
                    lesson.remainingLabel.text = "";
                    var doneText:String="";
                    var avgTimes:Number=0;
                    var totalErrors:uint=0;
                    for (var i:uint=0; i<base; i++) {
                        doneText = doneText + "\nfor " + i + " was " + Math.floor(numberTimes[i]/samples) + " with " + errors[i] + " errors";
                        avgTimes += numberTimes[i];
                        totalErrors+= errors[i];
                    var average:Number = Math.floor(avgTimes/base/samples);
                    var penalty:Number = Math.floor(totalErrors*Math.min(average, 2000)/base/samples);
                    var score:Number = average + penalty;
                    var comment:String = "";
                    doneText = doneText + "\nFor all including penalty was " + score + " msecs";
                    doneText = doneText + "\nTotal errors " + totalErrors + ", penalty: " + penalty + " msecs";
                    if (totalErrors == 0 && score < 1000) {
                        comment = "Excellent";
                    } else {
                        if (totalErrors/base/samples <= 0.05 && score < 1000) {
                            comment = "Well Done";
                        } else {
                            comment = "Practice reduces time and errors";
                    lesson.intro.text = comment + "\n\nAverage Times (in 1/1000th of a second)" + doneText;
            private function randomDim():String {
                var dimArray:Array=new Array;
                dimArray=["null","x","y","z"];
                return dimArray[Math.floor(Math.random() * 4)];
            private function wakeUp():void {
                clearInterval(sleepID);
                newNumber();
            private function giveHint():void {
                lesson.hint.text="Try " + subquanAnswer;
            public function setNormalization(n:Number):void {
                normalization = n;
                normalizationStop = n;
                atAStop=true;
                switch (n) {
                    case 0 :
                        lesson.scaleText.text=ToScale;
                        break;
                    case 1 :
                        lesson.scaleText.text=Normalized;
                        break;
                    default :
                        lesson.scaleText.text=NotToScale;
            public function smoothScale(target:Number):void {
                if (normalization > target) {
                    if (normalization - smoothStep <= target) {// At target, stop scaling
                        normalization=target;
                        atAStop=true;
                        clearInterval(smoothIntervalID);
                    } else {
                        normalization-= smoothStep;
                } else {
                    if (normalization + smoothStep >= target) {
                        normalization=target;
                        atAStop=true;
                        clearInterval(smoothIntervalID);
                    } else {
                        normalization+= smoothStep;
                number.scaleDigits(normalization);
            // IMPORTANT: Don't forget to press Ctrl + Enter to run n code and then on that preview screen,
            //      go to the menu and select Control then Disable Keyboard Shortcuts.
            private function keyDownFunc(event:KeyboardEvent):void {
                var key:uint=event.keyCode;
                var mathKey:String=null;
                switch (key) {
                    case 8 ://backspace key
                    case 46 ://delete key
                        trace("I am here");
                        //code to exit goes here
                        break;
                    case 13 :// Enter/retrun key.  Clear entry to start over.  SEE IMPORTANT NOTE
                        answerSoFar="";
                        answerSign=true;
                        lesson.clearAnswer;
                        lesson.clearGrade;
                        break;
                    case 37 :// Left arrow - change normalization stop
                        if (normalization - smoothStep <= 0) {// Set normalizationStop to fullscale
                            setNormalization(0);
                        } else {
                            setNormalization(normalization - smoothStep);
                        number.scaleDigits(normalizationStop);
                        break;
                    case 38 :// Up arrow
                        if (normalization == 1) {
                            atAStop=false;
                            lesson.scaleText.text=NotToScale;
                            clearInterval(smoothIntervalID);
                            smoothIntervalID=setInterval(smoothScale,10,normalizationStop);
                        if (normalization == normalizationStop) {
                            atAStop=false;
                            lesson.scaleText.text=ToScale;
                            clearInterval(smoothIntervalID);
                            smoothIntervalID=setInterval(smoothScale,10,0);
                        break;
                    case 39 :// Right arrow - change normalization stop
                        if (normalization + smoothStep >= 1) {// Set normalizationStop to normalized
                            setNormalization(1);
                        } else {
                            setNormalization(normalization + smoothStep);
                        number.scaleDigits(normalizationStop);
                        break;
                    case 40 :// Down arrow
                        if (normalization == 0) {
                            atAStop=false;
                            lesson.scaleText.text=NotToScale;
                            clearInterval(smoothIntervalID);
                            smoothIntervalID=setInterval(smoothScale,10,normalizationStop);
                        if (normalization == normalizationStop) {
                            atAStop=false;
                            clearInterval(smoothIntervalID);
                            smoothIntervalID=setInterval(smoothScale,10,1);
                            lesson.scaleText.text=Normalized;
                        break;
                    case 109 :// '-' on keypad pressed
                    case 189 :// '-' key pressed
                        if (! answerSign ) {
                            answerSoFar="";
                            answerSign=true;
                            lesson.answer.text="";
                        } else {
                            answerSoFar="-";
                            answerSign=false;
                            lesson.answer.text=answerSoFar;
                        lesson.clearGrade();
                        break;
                    default :
                        if (48 <= key && key < 58) {
                            mathKey=String(key - 48);
                        if (96 <= key && key < 106) {
                            mathKey=String(key - 96);
                        if (mathKey) {
                            if (newLesson) {
                                newLesson = false;
                                lesson.intro.text="";
                                newNumber();
                            } else {
                                if (! answered) {
                                    if (answerSoFar.length < subquanAnswer.length) {// Don't already have correct or incorrect answer
                                        answerSoFar+= mathKey;
                                        lesson.answer.text=answerSoFar;
                                    } else {// Have answer but want to change numbers
                                        answerSign=true;
                                        answerSoFar=mathKey;
                                        lesson.answer.text=answerSoFar;
                                        lesson.grade.text="";
                                    if (answerSoFar.length == subquanAnswer.length) {
                                        if (answerSoFar == subquanAnswer && answerSign == subquanAnswerSign) {// Correct Answer
                                            numberTimes[num]+= getTimer() - checkTime;
                                            lesson.hint.text="";
                                            sounds.playAnswer();
                                            answered=true;// Prevent accidental overwrite of sleepID from rapid key presses
                                            clearInterval(hintID);
                                            clearInterval(sleepID);
                                            sleepID=setInterval(wakeUp,2000);
                                            lesson.grade.text=" CORRECT";
                                            lesson.grade.setTextFormat(lesson.correctAnswerFormat);
                                            if (questions) {
                                                stage.removeChild(questions);
                                            // TEMPLATE: Quantity(num:Number, newBase:Number, normalization:Number=1, scale:Number=1, dim:String="null")
                                            iterations -= 1;
                                            if (iterations) {
                                                questions=new Quantity(iterations,10,1,0.25,"x");
                                                stage.addChild(questions);
                                                questions.x = rightEdge - 30;
                                                questions.y = 80;
                                        } else {
                                            errors[num] += 1;
                                            lesson.grade.text=" INCORRECT";
                                            lesson.grade.setTextFormat(lesson.incorrectAnswerFormat);
                                } else {
                                    trace("Lesson1.keyDownFunc: Unnecessary number key entered");
                        } else {
                            trace("Lesson1.keyDownFunc: Unused keycode " + key + " is " + String.fromCharCode(key));

  • Stage reference from class

    How do I reference the stage from a class? I need to add eventlisteners to the
    stage for mouse movement. I also need to add custom cursors. I always get an error when I try to reference stage
    . anything. Or event if I do this:
    var stageRef:Stage;
    then later: stageRef.stage.addEventList.....
    What am I missing or not understanding?

    I cannot get it to work. Here is my code:
    package com {
    // core
    import flash.display.MovieClip;
    import flash.display.Stage;
    // import custom classes
    import com.main.BuildStageClass;
    import com.main.BootClass;
    import com.utils.RotateClass;
    import com.utils.ZoomClass;
    import com.utils.PanClass;
    import com.main.HotSpotClass;
    // initialize class
    public class DocClass extends MovieClip {
      // custom classes
      // variables
      public static var build_stage_class:BuildStageClass;
      public static var boot_class:BootClass;
      public static var rotate_class:RotateClass;
      public static var zoom_class:ZoomClass;
      public static var pan_class:PanClass;
      public static var hot_spot_class:HotSpotClass;
      // stage containers
      public static var main_stage:MovieClip;
      public static var background_layer:MovieClip;
      public static var content_layer:MovieClip;
      public static var popup_layer:MovieClip;
      // main constructor
      public function DocClass() {
       // initialize classes
       build_stage_class = new BuildStageClass();
       boot_class = new BootClass();
       rotate_class = new RotateClass();
       zoom_class = new ZoomClass();
       pan_class = new PanClass(this.stage);
       hot_spot_class = new HotSpotClass();
       // add containers to stage
       main_stage = new MovieClip();
       addChild(main_stage);
       background_layer = new MovieClip();
       main_stage.addChild(background_layer);
       content_layer = new MovieClip();
       main_stage.addChild(content_layer);
       popup_layer = new MovieClip();
       main_stage.addChild(popup_layer);
    ==========================
    Now inside the pan class:
    package com.utils{
    // import classes
    import flash.display.MovieClip;
    import flash.display.Stage;
    import flash.events.MouseEvent;
    import flash.geom.Point;
    import flash.ui.Mouse;
    // import main classes
    import com.DocClass;
    // initialize class
    public class PanClass extends MovieClip {
      // variables
      public var do_pan:Boolean = true;
      public var last_point:Number = 0;
      public var cur_point:Number = 0;
      public var hand_cursor:HandCursor;
      public var grab_cursor:PanCursor;
      private var myStage:Stage;
      // main constructor
      public function PanClass(docClassStage:Stage) {
       // constructor code
       myStage = docClassStage;
       myStage.addEventListener(MouseEvent.MOUSE_MOVE, panHandler);
    Ideas?

  • Class for shortcuts

    Hi,
    is there any class in Java to handle keybord shortcuts?
    E.g. I have a following part of code:
    JPanel panel = new JPanel();
    getContentPane().add(panel, BorderLayout.NORTH);
    panel.setLayout(new FlowLayout(FlowLayout.LEFT));
    JButton button = new JButton("Some stuff");
    panel.add(button);
    button.addActionListener(new ActionListener(){
         public void actionPerformed(ActionEvent e) {
              if(!isModified) {
                   resetGrid();
                   readData();
    I need that button to respond even if I press CTRL+R on my keybord for instance. Is there such a class, or do I have to handle that with some EventListeners?
    Thanks in advance. Lokutus.

    This is usually solved with the Actions framework.
    http://java.sun.com/docs/books/tutorial/uiswing/misc/action.html

  • How do i open a web page with VeriSign Class 3 Extended Validation SSL SGC SS CA certfificate i can't open web pages with this, how do i open a web page with VeriSign Class 3 Extended Validation SSL SGC CA certfificate i can't open web pages with this

    how do i open a web page with VeriSign Class 3 Extended Validation SSL SGC SS CA ?

    Hi
    I am not suprised no one answered your questions, there are simply to many of them. Can I suggest you read the faq on 'how to get help quickly at - http://forums.adobe.com/thread/470404.
    Especially the section Don't which says -
    DON'T
    Don't post a series of questions in  a single post. Splitting them into separate threads increases your  chances of a quick answer.
    PZ
    www.pziecina.com

  • Previewing an image before uploading it using the FileReference class

    Previewing an image before uploading it using the FileReference class in flash player 3 not in SDK4

    Previewing an image before uploading it using the FileReference class in flash player 3 not in SDK4

  • Previewing an image before uploading it using the FileReference class in flex 3

    Previewing an image before uploading it using the FileReference class in flex 3 ?

    hai,
              when this code is used in my application ,i got the name of image and new frame is added each time .But image is not displayed.....
    The code  starts like this
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
                xmlns:mx="library://ns.adobe.com/flex/mx" initialize="init()"   backgroundColor="white" width="100%" height="100%">
        <fx:Script>
    <![CDATA[ 
                    import mx.controls.Alert;
                    import mx.messaging.Channel;
                    import mx.messaging.ChannelSet;
                    import mx.messaging.channels.AMFChannel;
                    import mx.rpc.events.ResultEvent;
                    import mx.controls.Image;
                    import spark.events.IndexChangeEvent;
                    import mx.managers.DragManager;
      <mx:DataGridColumn headerText="Dimension Value"  width="10" dataField="dimensionValue"/>
                                                   <mx:DataGridColumn headerText="Unit Nmae"  width="10" dataField="dimensionUnitName"/>
                                                   </mx:columns>
                                           </mx:DataGrid>
                                           <mx:Spacer width="2%"/>
                                       </mx:HDividedBox>
                                       </mx:VBox>
                   <mx:Spacer height="0"/>
                <mx:VBox width="100%">
                    <s:HGroup height="90" top="0" left="0" right="0" verticalAlign="justify" gap="10" paddingLeft="5" paddingRight="5" paddingTop="5" paddingBottom="5">
                        <s:Button id="btn_loader" top="5" bottom="24" width="100" label="load" click="loadImages()"/>
                        <s:Group width="100%">
                            <s:Group name="cl" top="0" left="0" bottom="0" width="20" mouseOver="//scroll_on(event)" mouseOut="//scroll_off(event)">
                                <s:BitmapImage source="@Embed('../assets/left.jpg')" top="0" left="0" bottom="0" right="0" fillMode="scale"/>   
                            </s:Group>
                            <s:List id="imgList" skinClass="skins.ListSkin" top="-3" left="27" right="28" bottom="10"
                                    dataProvider="{ImageCollection}" itemRenderer="Image_Render">
                                <s:layout>
                                    <s:HorizontalLayout gap="0"/>
                                </s:layout>
                            </s:List>
                            <s:Group name="cr" top="0" right="0" bottom="0" width="20" mouseOver="//scroll_on(event)" mouseOut="//scroll_off(event)">
                                <s:BitmapImage source="@Embed('../assets/right.jpg')" top="-1" left="0" bottom="0" right="0" fillMode="scale"/>
                            </s:Group>
                        </s:Group>
                    </s:HGroup>
                    <s:SkinnableContainer id="dropCanvas" top="100" left="5" right="5" bottom="5" backgroundAlpha="1.0" alpha="1.0"
                                          dragEnter="dropCanvas_dragEnterHandler(event)"
                                          dragDrop="dropCanvas_dragDropHandler(event)" contentBackgroundColor="#914E4E" backgroundColor="#F7F7F7">
                    </s:SkinnableContainer>
                </mx:VBox>
                <mx:Spacer height="5"/>
                                      </mx:VDividedBox>
        </mx:Panel>
    </mx:Canvas>

  • Get the values from the bean class?

    Hi Praveen and all can u please suggest in this,
    I have developped an application In that Create One java class that Extends PageProcesscomponenet and utilizing the Bean That have the Connetion method and retriving the query Based on the Logon customer and spoof customer.
    this functionality I have developped in Pageprocessor component.
    The same functinality I am utilizing another java Class that Extends AbstractPortalcomponent  and utilizing the same Bean.
    But the problem both java classes for I used one Jsp only Dynmic spoof customer will come from the JSP Input filed.
    In the new Java Class How can I capture the Event When I click the Buttong the InputField value capturing into the AbstractPortalcomponent Class.
    I tried like this but It comes as Null Value.
    Event event = myContext.getCurrentEvent();
                              if(event!=null)
                                  InputField ip= (InputField) myContext.getComponentForId("spoofCust");
                                  String spoofCust=ip.getValue().toString();
    Please suggest me in this.
    What is wrong with this.
    Thanks,
    Lohi.
    Message was edited by:
            Lohitha M

    Lohitha,
    Try replacing your two lines of code:
    InputField ip= (InputField) myContext.getComponentForId("spoofCust");
    String spoofCust=ip.getValue().toString();
    with:
    InputField ip = (InputField) getComponentByName("spoofCust");     
    String spoofCust = ip.getValueAsDataType().toString();
    Let me know how that works for you.
    -John

Maybe you are looking for

  • Illustrator CS6 chrashes shortly after startup

    Hi, starting Illustrator CS6 under User A works fine. Starting under User B it crahes shortly after startup, showing the menu bar for not even a second. I did not find any Illustrator plist files in the user library which I can remove. So here is my

  • Maximizing Airport Extreme Speed

    Hello All, I'm currently running my home wireless network with an Airport Extreme with b/g/n 2.4GHz setting. I want to be able to run a/n 5GHz only, to take advantage of the full speed. The issues is my roommate only has a g-enable Dell, and he would

  • Sharing Internet Connection from iMac to MacBook Pro

    I've arrived home for the holiday from university and, of course, brought my MacBook Pro home with me. My family does not have a wireless Internet connection as I do at uni, but they do have an iMac connected to a cable modem via ethernet. So I have

  • KM Management in Portal

    Hi, I have a Query Help documents (Custom) which provides information about queries. Every query in our system will be accompanied by a Help Document. How can I upload those documents to BI Meta Data repository and access them in Portal Thanks

  • How to turn off automaticly zoom-in

    Hi, I have the IPhone 5s and whenever I try to take a video it automaticly zoom-in and I'm asking you how to turn it off, and when I'm changing my background to a picture I got from the internet It seems to be too big so the whole picture can't fit i