onEnterFrame = function belonging to a category

Hi all

I created a class that has a method that receives an XML node. Currently, we use a loop for to go through the XML data, like this:

for (var i = 0; i < =(myXML.childNodes.length-1); i ++) {}
Internal actions
}

Now, this would work fine if the node XML received by this method has 10 knots, 20 knots and so on. But I'm going to need it to deal with anywhere between 1000 to 2000 nodes.

If I had to write this code on the timeline, I would use an onEnterFrame action to pierce through a node 2000 XML, like this:

var i = 0;
this.onEnterFrame = function() {}
If (I < =(myXML.childNodes.length-1)) {}
Internal actions
i ++ ;
} else {}
this.onEnterFrame = null;
}
}

But I want to do something like this in a class. But any attempt to use the onEnterFrame in a class above did not work. Nothing in the onEnterFrame never gets called.

I'm still a little fuzzy how to write classes so any help is appreciated.

Thank you
Chris

Hello

A number of things.

When I use "onEnterFrame = function()", I get an error "There is no property with the name"onEnterFrame"."

So I tried too:

Within the method in my class

var obj:Object;

obj.onEnterFrame = callThisFundtion();

This works, but only call this function once.

Any ideas?

Thanks again
Chris

Tags: Adobe Animate

Similar Questions

  • How do you find the range that a function belongs?

    If you discover a function and want to use it, how do you find the range that a function belongs?  I know how to find a function, but don't tell me how to find his range.

    Thanks in advance.

    When you search for a function and double-click on the result, it will bring to the top of the tree of range of features and show you how to get to this function:

  • Remove the onEnterFrame function

    How can I remove the onEnterframe?

    CODE:

    function foo() {}

    If (I > = endpoint) {}

    do something

    } else {}

    remove the onEnterFrame?

    }

    }

    btn_mc.onRollOver = function() {}

    _root.onEnterFrame = myFunc;

    }

    :

    CODE:

    function foo() {}

    If (I > = endpoint) {}

    do something

    } else {}

    Remove _root.onEnterFrame;

    }

    }

    btn_mc.onRollOver = function() {}

    _root.onEnterFrame = myFunc;

    }

  • height to get the label to determine it's belonging to a category

    I had something like this:


    var myClass:myClass = new MyClass;
    addChild (myClass.showLabel);

    Then, within this class, there is this code:


    public class myClass {}
    private var myLabel:Label;
    private var myCanvas:Canvas;
    public function myClass() {}

    myCanvas = new canvas;
    myCanvas.width = 30;
    myCanvas.height = 30;
    myCanvas.x = 30;
    myCanvas.y = 30;

    myLabel is new label;.
    myCanvas.addChild (myLabel);
    }

    public function showLabel (): Web {}
    MyLabel.set_Text = "example";
    myLabel.y = myCanvas.height/2 - myLabel.height/2;
    return myCanvas
    }

    When debugging I see that "myLabel.height" = 0. I don't know how to find it is the final height. I tried to use myCanvas.validateNow () myLabel.y in deciding, but it did not work.

    Hi lbarim,

    Try myLabel.measuredHeight instead of myLabel.height...

    Also write myLabel.validateNow (); as well as myCanvas.validateNow ();

    Note: myLabel.validateNow (); may not be entirely necessary... However try it once... you can get with myLabel.measuredHeight to...

    If this post answers your question or assistance, please mark it as such.

    Thank you

    Jean Claude Chari

  • Calling the function from inside a onEnterFrame action

    I have a class file called MonsterGame. Inside her, one of the methods that are called "queueAnim" creates a onEnterFrame function to wait until the current film is play before making the following visible.

    That works fine, but I have certain conditions that the Main() function is called just after a certain movie is played (called "eatMovie"). Everything works except the call to Main();

    I think it's a problem with SEO in the wrong place, but I don't know why.

    The trace for "this should be the root name" returns "MonsterGame", which is the name of the class where the Main() method. So if this ._name returns MonsterGame and MonsterGame has Main() inside, why used Main() or that. Main() run the function?

    PS: It's NOT because I remove the onEnterFrame before calling the Main(), at least I'm sure it's not because I put a trace here, and it works very well, proving that after deleting lines are always executed.

    PM me if you want the link to the source code and swf file

    Try the attached code. If not post a link to a zip with all the files.

  • Check the product within the category

    Hello

    How can I get a category by id and check if a product id is inside this category? Could be on jsp or java.

    Thank you.

    Hello

    In JSP, you can use droplets and then iterate over all products CategoryLookup







    Check the product here



    But all you want to do is to check if the product is in the category of use/atg/commerce/catalog/ProductLookup the same way and use 'ancestorCategories' or 'ancestorCategoryIds' to check if the product belong to this category

    In JAVA, use atg.commerce.catalog.CatalogTools and its function findCategory (String categoryId) to get the category then use getPropertyValue ("childProducts") for all products. To get the product using findProduct(String productId), then getPropertyValue("parentCategories") to get this product categories.

    --
    Angelique

  • Find a VM without label in particular category

    Hello

    I make use of tags, so I can identify when VM are under review. I have a category called 'Expiration Date' and they contain tags baptized with the name of the month.
    I want to get the list of the VM who don't have an assigned tag belonging to the category "expiry Date".

    The following returns my VM and associated tags

    Get - vm | Select name,@{N="Tag; E = {(get-tagassignment_$_.name).tag.category}}

    An example of output would be as follows

    Name

    VM1

    VM2 expiration date

    VM3 expiration date

    VM4

    I want to recover just vm1 and vm4 because they do not have associated tag but can't seem to make it work

    I tried to join "where {$_.tag - eq $null}" but it gives me the same exact result

    I also tried to use the following command

    Get - vm | Select name,@{N="Tag; {E = {(get-tagassignment_$_.name).tag | where {$_.tag - notmatch 'Expiry Date'}}}


    This returns also all VM without worrying if they tag value.


    Any ideas as to what I'm doing wrong?

    Try something like this

    $cat = get-TagCategory-name of the "expiry Date".

    Get - VM |

    Where {Get-TagAssignment-entity $_-category $cat} |

    Select Name,@{N="Tag; E = {(Get-TagAssignment_$_.name).tag}}

  • I want to call a function on mouse click...

    my button script is...

    on (release) {}

    _root.newThumbs ();

    }

    and complete scripts...

    Import mx.transitions.Tween;

    Mx.transitions.Zoom import. *;

    Caurina.transitions import. *;

    var myGalleryXML = new XML();

    myGalleryXML.ignoreWhite = true;

    myGalleryXML.load ("gallery24.xml");

    myGalleryXML.onLoad = function() {}

    _root.gallery_x is myGalleryXML.firstChild.attributes.gallery_x = 100;.

    _root.gallery_y = myGalleryXML.firstChild.attributes.gallery_y;

    _root.gallery_width = myGalleryXML.firstChild.attributes.gallery_width;

    _root.gallery_height = myGalleryXML.firstChild.attributes.gallery_height;

    _root.MyImages = myGalleryXML.firstChild.childNodes;

    _root.myImagesTotal = myImages.length;

    _root.thumb_height = myGalleryXML.firstChild.attributes.thumb_height;

    _root.thumb_width = myGalleryXML.firstChild.attributes.thumb_width;

    _root.full_x = myGalleryXML.firstChild.attributes.full_x;

    _root.full_y = myGalleryXML.firstChild.attributes.full_y;

    callThumbs();

    };

    function callThumbs() {}

    _root.createEmptyMovieClip ("Wall", _root.getNextHighestDepth ());

    Wall._X is _root.gallery_x = 0;.

    Wall._y is _root.gallery_y = 230;.

    wall.addEventListener (MouseEvent.CLICK);

    var clipLoader = new MovieClipLoader();

    preloader var = new Object();

    clipLoader.addListener (preloader);

    / * myImagesTotal * /.

    for (i = 0; i < 6; i ++) {}

    thumbURL = myImages [i].attributes.thumb_url;

    myThumb_mc = wall.createEmptyMovieClip (i, wall.getNextHighestDepth ());

    myThumb_mc._x = _root.thumb_height * i;

    myThumb_mc._x = _root.thumb_position = 3260 + I * 765;

    clipLoader.loadClip("shop/"+thumbURL,myThumb_mc);

    preloader.onLoadStart = {function (target)}

    target.createTextField ("my_txt", target.getNextHighestDepth (), 0,0,10, 10);

    Target.my_txt. Selectable = false;

    };

    preloader.onLoadProgress = function (target, loadedBytes, totalBytes) {}

    Target.my_txt. Text = Math.floor ((loadedBytes/totalBytes) * 100);

    };

    preloader.onLoadComplete = {function (target)}

    The new Tween (target, "_alpha", Strong.easeOut, 0, 100,.5, true);

    Target.my_txt.removeTextField ();

    target.onRelease = function() {}

    callFullImage (this._name);

    };

    target.onRollOver = function() {}

    This ._alpha = 100;

    };

    target.onRollOut = function() {}

    This ._alpha = 100;

    };

    };

    }

    for (i = 6; i < 12; i ++) {}

    thumbURL = myImages [i].attributes.thumb_url;

    myThumb_mc = wall.createEmptyMovieClip (i, wall.getNextHighestDepth ());

    myThumb_mc._x = _root.thumb_height * i;

    myThumb_mc._x = _root.thumb_position =-7367 + I * 765;

    myThumb_mc._y is _root.thumb_position = 180;.

    clipLoader.loadClip("banner/"+thumbURL,myThumb_mc);

    preloader.onLoadStart = {function (target)}

    target.createTextField ("my_txt", target.getNextHighestDepth (), 0,0,10, 10);

    Target.my_txt. Selectable = false;

    };

    preloader.onLoadProgress = function (target, loadedBytes, totalBytes) {}

    Target.my_txt. Text = Math.floor ((loadedBytes/totalBytes) * 100);

    };

    preloader.onLoadComplete = {function (target)}

    The new Tween (target, "_alpha", Strong.easeOut, 0, 100,.5, true);

    Target.my_txt.removeTextField ();

    target.onRelease = function() {}

    callFullImage (this._name);

    };

    target.onRollOver = function() {}

    This ._alpha = 100;

    };

    target.onRollOut = function() {}

    This ._alpha = 100;

    };

    };

    }

    }

    function callFullImage (myNumber) {}

    myURL = myImages [MyNumber to].attributes.full_url.

    myTitle = myImages [MyNumber to].attributes.title.

    _root.createEmptyMovieClip ("Ajit", _root.getNextHighestDepth ());

    Ajit._X is _root.full_x = 130;.

    Ajit._y is _root.full_y = 32;.

    _root.onEnterFrame = function() {}

    Wall._alpha = 0;

    if(_root._currentframe==2)

    Wall._alpha = 100;

    }

    this.gotoAndStop (21);

    var fullClipLoader = new MovieClipLoader ("ajit");

    var fullPreloader = new Object();

    fullClipLoader.addListener (fullPreloader);

    fullPreloader.onLoadStart = {function (target)}

    target.createTextField ("my_txt", ajit.getNextHighestDepth (), 0,0,400, 20);

    Target.my_txt. Selectable = false;

    };

    fullPreloader.onLoadProgress = function (target, loadedBytes, totalBytes) {}

    Target.my_txt. Text = Math.floor ((loadedBytes/totalBytes) * 100);

    };

    fullPreloader.onLoadComplete = {function (target)}

    The new Tween (target, "_alpha", Strong.easeOut, 0, 100,.5, true);

    Target.my_txt. Text = myTitle;

    };

    fullClipLoader.loadClip("full_images/"+myURL,ajit);

    }

    function newthumb() {/ /wand to call this function on mouse release}

    _root.createEmptyMovieClip ("Wall", _root.getNextHighestDepth ());

    Wall._X is _root.gallery_x = 0;.

    Wall._y is _root.gallery_y = 230;.

    wall.addEventListener (MouseEvent.CLICK);

    var clipLoader = new MovieClipLoader();

    preloader var = new Object();

    clipLoader.addListener (preloader);

    / * myImagesTotal * /.

    for (i = 12; i < 13; i ++) {}

    thumbURL = myImages [i].attributes.thumb_url;

    myThumb_mc = wall.createEmptyMovieClip (i, wall.getNextHighestDepth ());

    myThumb_mc._x = _root.thumb_height * i;

    myThumb_mc._x = _root.thumb_position = 3260 + I * 765;

    clipLoader.loadClip("banner/"+thumbURL,myThumb_mc);

    preloader.onLoadStart = {function (target)}

    target.createTextField ("my_txt", target.getNextHighestDepth (), 0,0,10, 10);

    Target.my_txt. Selectable = false;

    };

    preloader.onLoadProgress = function (target, loadedBytes, totalBytes) {}

    Target.my_txt. Text = Math.floor ((loadedBytes/totalBytes) * 100);

    };

    preloader.onLoadComplete = {function (target)}

    The new Tween (target, "_alpha", Strong.easeOut, 0, 100,.5, true);

    Target.my_txt.removeTextField ();

    target.onRelease = function() {}

    callFullImage (this._name);

    };

    target.onRollOver = function() {}

    This ._alpha = 100;

    };

    target.onRollOut = function() {}

    This ._alpha = 100;

    };

    };

    }

    }

    If the newthumb() function is what you want to call when the button is clicked, you must call this function instead of newThumbs()... spelling and capitalization issues.

    You must take this code the button and put it in the timeline to the contrary - code 'on' objects should be avoided.  Name the button instance, perhaps something like "newThumbBtn" and assign it by clicking code as below with all other codes show you...

    newThmubBtn.onRelease = function() {}

    newthumb();

    }

  • Repeat function for duplicate movieclip help please

    In my game, I have a button (fireBtn) that duplicates a movieclip of a fire.  I also have a button of water (waterBtn), which turns off the fire and remove the movieclip (s) dual fire.   Finally, there is a button 'Reset' (reset_mc) which removes the movieclip (s) on double fire and resets all other players.  Here is the code:

    Creates the fire


    {fireBtn.onPress = function ()}
    i ++ ;
    _root.fireMC.duplicateMovieClip ("fireMC" + I, i);
    }

    {waterBtn.onRelease = function ()}
    waterBtn._visible = false;
    }

    Fades and deletes the fire


    waterBtn.onPress = fadeOut;

    function fadeOut() {}
    fireMC1.onEnterFrame = function() {}
    If (this ._alpha > = 0) {}
    This ._alpha-= 5;
    If (this ._alpha > = 100 | this ._alpha < = 0) {}
    for (var j: Number = 0; j < = i; j ++) {}
    {if (TL ["fireMC" + j])}
    TL ["fireMC" + j] .removeMovieClip ();
    }
    }
    }
    }}}

    Also removes fire and restores the waterBtn


    {reset_mc.onRelease = Function ()}
    waterBtn._visible = true;
    for (var j: Number = 0; j < = i; j ++) {if (tl ["fireMC" + j]) {}
    TL ["fireMC" + j] .removeMovieClip ();
    }
    }

    It works fine the first time, but after using the reset double created fire fade or remove.  I think it has something to do with the designation of the movieclips in double (12th line of code).  I would like duplicated fires to always fade no matter how many times reset you but I don't have a clue as to how to code it.  I hope this makes sense.  Any help would be appreciated. Thanks in advance.

    Try

    {reset_mc.onRelease = Function ()}

    waterBtn._visible = true;

    for (var j: Number = 0; j<>

    TL ["fireMC" + j] .removeMovieClip ();

    }

    i = 0; //<----- reset ="">

    }

  • unique function for multiple buttons

    Hello

    My problem is that I am using the following functions on 10 different logo movieclips. Each movieclip logo has a popup box (another mc) within its timeline with a description in. When I hover over the logo movieclip I want him to call the function of frames forward and on hover the rewindframes function call.


    function forwardFrames() {}

    onEnterFrame = function () {}

    If (_currentframe! = 15) {}

    nextFrame();

    } else {}

    Stop();

    delete this ["onEnterFrame"];

    }

    };

    }

    function rewindFrames() {}

    onEnterFrame = function () {}

    If (_currentframe! = 1) {}

    prevFrame();

    } else {}

    Stop();

    delete this ["onEnterFrame"];

    }

    };

    }

    However I am doing all of this on the main timeline, and the only way I can think to operate currently, it is if I do the following for each mc logo, there must be a better way:

    Symbol_1.onRollOver = function() {}

    Symbol_1.onEnterFrame = function () {}

    If (symbol_1._currentframe! = 15) {}

    Symbol_1.nextFrame ();

    } else {}

    Symbol_1.stop ();

    delete this ["onEnterFrame"];

    }

    };

    }

    Symbol_1.onRollOut = function() {}

    Symbol_1.onEnterFrame = function () {}

    If (symbol_1._currentframe! = 1) {}

    Symbol_1.prevFrame ();

    } else {}

    Symbol_1.stop ();

    delete this ["onEnterFrame"];

    }

    };

    }

    Any advice would be much appreciated, thanks

    Daniel

    You should be able to use something like the following...

    Symbol_1.onRollOver = symbol_2.onRollOver = playFwd;

    function playFwd() {}
    this.onEnterFrame = function () {}
    If (this ._currentframe! = 15) {}
    this.nextFrame ();
    } else {}
    This.Stop ();
    delete this.onEnterFrame;
    }
    }
    }

    Symbol_1.onRollOut = symbol_2.onRollOut = return;

    function rewind() {}
    this.onEnterFrame = function () {}
    If (this ._currentframe! = 1) {}
    this.prevFrame ();
    } else {}
    This.Stop ();
    delete this.onEnterFrame;
    }
    };
    }

  • How to stop a function?

    I have this code I want to end on a specific image? How would I do that? It could also be called on to play 115 images if it's easier.

    SCREEN_WIDTH = 750

    screen_height = 475

    frequency = 0 / / < < INCREASE TO REDUCE the QUANTITY PAPERS

    //

    //

    MovieClip.prototype.serConfeti = function () {}

    This._x = Math.ceil (Math.Random () * SCREEN_WIDTH)

    This._xscale = Math.ceil (Math.Random () * screen_height)

    This ._yscale = this ._xscale

    This.Mover)

    This.coloreame)

    }

    function getPorcentaje() {}

    var number = Math.ceil (Math.random () * 20)

    return number

    }

    getOffset() {} function

    var number = Math.ceil (Math.random () * 255)

    var buleano = Math.round (Math.random () * 1)

    If (buleano == 1) {}

    number = number * 1

    }

    return number

    }

    MovieClip.prototype.mover = function () {}

    this.onEnterFrame = function () {}

    If (this ._y < 475) {}

    This ._y += 10

    This ._xscale = Math.random () * 100

    This ._rotation = Math.random () * 360

    } else {}

    this.removeMovieClip)

    }

    }

    }

    MovieClip.prototype.caidaConfeti = function () {}

    this.createEmptyMovieClip("caida_mc",1)

    var count = 0

    var confCount = 1

    This.caida_mc.onEnterFrame = Function () {}

    if(Count<frecuency) {}

    Count ++

    } else {}

    this.attachMovie ("conf", "conf" + confCount, confCount)

    eval("this.caida_mc.conf"+confCount).serConfeti)

    Count = 1

    confCount ++

    }

    }

    }

    //

    _root.caidaConfeti)

    When you want to stop this loop, use:

    delete _root.caida_mc.onEnterFrame;

  • Function _alpha fade

    Hi, so I try to fade a piece of text that I'm loading through XML in and out (as well as the move to its location).  The fade on the part works very well, and so I have a _alpha.100 command where I am currently call my function 'slidein' (really melted in function) it works fine. No idea why! I tried about 100 different locations and I'm stumped... It is very disturbing.  Any help would be greatly appreciated.

    function loadXML (loaded) {}
    If {(responsible)
    xmlNode = this.firstChild;
    Caption = [];
    URL = [];
    Total = xmlNode.childNodes.length;
    for (i = 0; i < total; i ++) {}
    Legend [i] = xmlNode.childNodes [i] Sublst.ChildNodes(1).ChildNodes(0) [0].firstChild.nodeValue;
    URL [i] = xmlNode.childNodes [i] Sublst.ChildNodes(1).ChildNodes(0) [1].firstChild.nodeValue;
    }
    first_item();
    } else {}
    Content = "file not loaded! ';
    }
    }
    xmlData = new XML();
    xmlData.ignoreWhite = true;
    xmlData.onLoad = loadXML;
    xmlData.load ("newstick.xml");
    //
    newsMC.newsText.autoSize = 'center ';

    function first_item() {}
    Delay = 0;
    p = 0;
    Display (p);
    p ++ ;
    }
    BarrowR.onRelease = function() {}
    myInterval = setInterval (ticker, delay);
    function ticker() {}
    clearInterval (myInterval);
    If (p == total) {}
    p = 0;
    }
    slideout();
    }
    }
    function display (pos) {}
    newsMC.newsText._x = 51;
    more = new TextFormat();
    over. Underline = true;
    //
    out = new TextFormat();
    out. Underline = false;
    //
    SlideIn();
    trace (newsMC.newsText._alpha);
    newsMC.newsText.text = caption [pos];
    //
    newsMC.onRollOver = function() {}
    this.newsText.setTextFormat (over);
    };
    newsMC.onRollOut = function() {}
    this.newsText.setTextFormat (out);
    };
    }

    function slideout() {}
    this.onEnterFrame = function() {}
    If (newsMC.newsText._x < = 330) {}
    newsMC.newsText._x += 10;
    If (newsMC.newsText._alpha > = 0) {}
    newsMC.newsText._alpha = 10;
    }} else {}
    newsMC.newsText._x = 191;
    newsMC.newsText._alpha = 0;
    Display (p);
    p ++ ;
    delete this.onEnterFrame;
    }
    };
    }

    function slidein() {}
    trace (newsMC.newsText._alpha);
    this.onEnterFrame = function() {}
    If (newsMC.newsText._alpha < 100) {}
    newsMC.newsText._alpha += 10;
    } else {}
    newsMC.newsText._alpha = 100;
    newsMC.newsText._alpha = 100;
    delete this.onEnterFrame;
    }
    };
    }

    Stop();

    OK, you can delete all funcitons of trace().

    the problem is due to your enterframe loop cannot be replaced by the enterframe loop in slideout() (in slidein()).

    to remedy this, use a different movieclip for slidein() and slideout() enterframe loops.  for example:

    var mc_loop1:MovieClip=this.createEmptyMovieClip("mc_loop1",this.getNextHighestDepth());

    var mc_loop2:MovieClip=this.createEmptyMovieClip("mc_loop2",this.getNextHighestDepth());

    function slideout() {}
       mc_loop1.onEnterFrame = function() {}
    If (newsMC.newsText._x<=330)>
    newsMC.newsText._x += 10;

    }
    If {(newsMC.newsText._alpha>0)}
    newsMC.newsText._alpha = 10;
    } else {}
    newsMC.newsText._x = 191;
    newsMC.newsText._alpha = 0;
    Display (p);
    p ++ ;
    delete this.onEnterFrame;
    }
    };
    }

    function slidein() {}
       mc_loop2.onEnterFrame = function() {}
    If (newsMC.newsText._alpha<100)>
    newsMC.newsText._alpha += 10;
    } else {}
    newsMC.newsText._alpha = 100;
    newsMC.newsText._alpha = 100;
    delete this.onEnterFrame;
    }
    };
    }

    Stop();

  • How to pass values from one function to the other

    Hello

    I am a school teacher and a beginner in Flash Actionscript. I am creating a countdown for use in my classroom during testing. The beginning and break according to need, but not the pause button functions. When I click on the pause button, the timer is reset to 0:00:00. Help, please. Here is the code that I had written so far:

    var Subject1timeLeftHr;

    var Subject1timeLeftMin;

    var Subject1timeLeftSec;

    Subject1start_btn._visible = true;

    Subject1pause_btn._visible = false;

    Subject1rotor_mc.gotoAndStop (1);

    Subject1rotor_mc._visible = false;

    Subject1durationHr_txt. Text = "0";

    Subject1durationMin_txt. Text = "00";

    Subject1durationSec_txt. Text = "00";

    Selection.setFocus (Subject1durationHr_txt);

    function SubjectdurationHr (SubjectxdurationHr_txt, SubjectxdurationMin_txt)

    {

    if (SubjectxdurationHr_txt.length == 1)

    {

    Selection.setFocus (SubjectxdurationMin_txt);

    }

    }

    function SubjectdurationMin (SubjectxdurationMin_txt, SubjectxdurationSec_txt)

    {

    if (SubjectxdurationMin_txt.length == 2)

    {

    Selection.setFocus (SubjectxdurationSec_txt);

    }

    }

    function SubjectdurationSec (SubjectxdurationSec_txt, SubjectxdurationHr_txt)

    {

    if (SubjectxdurationSec_txt.length == 2)

    {

    Selection.setFocus (SubjectxdurationHr_txt);

    }

    }

    Subject1durationHr_txt. OnChanged = function()

    {

    SubjectdurationHr (Subject1durationHr_txt, Subject1durationMin_txt);

    };

    Subject1durationMin_txt. OnChanged = function()

    {

    SubjectdurationMin (Subject1durationMin_txt, Subject1durationSec_txt);

    };

    Subject1durationSec_txt. OnChanged = function()

    {

    SubjectdurationSec (Subject1durationSec_txt, Subject1durationHr_txt);

    };

    function startcountdown (SubjectxdurationLeft, SubjectxdurationHr, SubjectxdurationHr_txt, SubjectxdurationMin, SubjectxdurationMin_txt, SubjectxdurationSec, SubjectxdurationSec_txt, Subjectxduration, SubjectxstartTime, SubjectxendTime, Subjectxtimer_mc, Subjectxpause_btn, Subjectxstart_btn, Subjectxrotor_mc, SubjectxtimeLeft, SubjectxtimeLeftHr, SubjectxtimeLeftMin, SubjectxtimeLeftSec, SubjectxtimeLeftHr_txt, SubjectxtimeLeftMin_txt, SubjectxtimeLeftSec_txt)

    {

    delete SubjectxdurationLeft;

    delete SubjectxdurationHr;

    delete SubjectxdurationMin;

    delete SubjectxdurationSec;

    delete Subjectxduration;

    delete SubjectxdurationHr_txt.text;

    delete SubjectxdurationMin_txt.text;

    delete SubjectxdurationSec_txt.text;

    SubjectxstartTime = getTimer();

    Subjectxtimer_mc.onEnterFrame = function()

    {

    if (SubjectxdurationHr_txt.text == Nan |) SubjectxdurationMin_txt.text == Nan | SubjectxdurationSec_txt.text is Nan)

    {

    }

    else

    {

    SubjectxdurationHr = 60 * 60 * 1000 * Number (SubjectxdurationHr_txt.text).

    SubjectxdurationMin = 60 * 1000 * Number (SubjectxdurationMin_txt.text).

    SubjectxdurationSec = 1000 * Number (SubjectxdurationSec_txt.text).

    Subjectxduration = SubjectxdurationHr + SubjectxdurationMin + SubjectxdurationSec;

    SubjectxendTime = SubjectxstartTime + Subjectxduration;

    SubjectxdurationLeft = SubjectxendTime - getTimer();

    if (SubjectxdurationLeft > 0)

    {

    SubjectxdurationHr_txt._visible = false;

    SubjectxdurationMin_txt._visible = false;

    SubjectxdurationSec_txt._visible = false;

    Subjectxpause_btn._visible = true;

    Subjectxstart_btn._visible = false;

    Subjectxrotor_mc._visible = true;

    Subjectxrotor_mc.play ();

    SubjectxtimeLeft = SubjectxdurationLeft / (1000 * 60 * 60);

    SubjectxtimeLeftHr = Math.floor (SubjectxtimeLeft);

    SubjectxtimeLeftMin = Math.floor ((SubjectxtimeLeft-SubjectxtimeLeftHr) * 60);

    SubjectxtimeLeftSec = Math.floor (((SubjectxtimeLeft-SubjectxtimeLeftHr) * 60 - SubjectxtimeLeftMin) * 60);

    SubjectxtimeLeftHr_txt.text = String (SubjectxtimeLeftHr);

    if (SubjectxtimeLeftHr_txt.length < 1)

    {

    SubjectxtimeLeftHr_txt.text = '0' + SubjectxtimeLeftHr_txt.text;

    }

    SubjectxtimeLeftMin_txt.text = String (SubjectxtimeLeftMin);

    if (SubjectxtimeLeftMin_txt.length < 2)

    {

    SubjectxtimeLeftMin_txt.text = '0' + SubjectxtimeLeftMin_txt.text;

    }

    SubjectxtimeLeftSec_txt.text = String (SubjectxtimeLeftSec);

    if (SubjectxtimeLeftSec_txt.length < 2)

    {

    SubjectxtimeLeftSec_txt.text = '0' + SubjectxtimeLeftSec_txt.text;

    }

    }

    else

    {

    delete Subjectxtimer_mc.onEnterFrame;

    SubjectxtimeLeftHr_txt.text = "";

    SubjectxtimeLeftMin_txt.text = "";

    SubjectxtimeLeftSec_txt.text = "";

    SubjectxdurationHr_txt._visible = true;

    SubjectxdurationMin_txt._visible = true;

    SubjectxdurationSec_txt._visible = true;

    Subjectxrotor_mc.gotoAndStop (1);

    Subjectxrotor_mc._visible = false;

    SubjectxdurationHr_txt.text = '0 '.

    SubjectxdurationMin_txt.text = "00";

    SubjectxdurationSec_txt.text = "00";

    Subjectxpause_btn._visible = false;

    Subjectxstart_btn._visible = true;

    Selection.setFocus (SubjectxdurationHr_txt);

    }

    }

    };

    }

    function pausecountdown (SubjectxdurationHr_txt, SubjectxtimeLeftHr, SubjectxdurationMin_txt, SubjectxtimeLeftMin, SubjectxdurationSec_txt, SubjectxtimeLeftSec, Subjectxstart_btn, Subjectxpause_btn, Subjectxrotor_mc)

    {

    delete Subjectxtimer_mc.onEnterFrame;

    SubjectxdurationHr_txt.text = String (SubjectxtimeLeftHr);

    SubjectxdurationMin_txt.text = String (SubjectxtimeLeftMin);

    SubjectxdurationSec_txt.text = String (SubjectxtimeLeftSec);

    Subjectxstart_btn._visible = true;

    Subjectxpause_btn._visible = false;

    Subjectxrotor_mc.stop ();

    }

    Subject1pause_btn.onRelease = function()

    {

    pausecountdown (Subject1durationHr_txt, Subject1timeLeftHr, Subject1durationMin_txt, Subject1t, imeLeftMin, Subject1durationSec_txt, Subject1timeLeftSec, Subject1start_btn, Subject1pause_btn, Subject1rotor_mc);

    };

    Subject1start_btn.onRelease = function()

    {

    startcountdown (Subject1durationLeft, Subject1durationHr, Subject1durationHr_txt, Subject1dura, tionMin, Subject1durationMin_txt, Subject1durationSec, Subject1durationSec_txt, Subject1durati, Subject1startTime, Subject1endTime, Subject1timer_mc, Subject1pause_btn, Subject1start_btn, Subject1rotor_mc, Subject1timeLeft, Subject1timeLeftHr, Subject1timeLeftMin, Subject1timeLeftS ec, Subject1timeLeftHr_txt, Subject1timeLeftMin_txt, Subject1timeLeftSec_txt);

    };

    Subject1cancel_btn.onRelease = function()

    {

    Subject1timeLeftHr_txt.text = "";

    Subject1timeLeftMin_txt.text = "";

    Subject1timeLeftSec_txt.text = "";

    Subject1durationHr_txt._visible = true;

    Subject1durationMin_txt._visible = true;

    Subject1durationSec_txt._visible = true;

    Subject1durationHr_txt.text = '0 '.

    Subject1durationMin_txt.text = "00";

    Subject1durationSec_txt.text = "00";

    Subject1timeLeftHr_txt._visible = true;

    Subject1timeLeftMin_txt._visible = true;

    Subject1timeLeftSec_txt._visible = true;

    Subject1pause_btn._visible = false;

    Subject1start_btn._visible = true;

    Subject1rotor_mc._visible = false;

    Subject1rotor_mc.gotoAndStop (1);

    delete Subject1timer_mc.onEnterFrame;

    delete Subject1durationLeft;

    delete Subject1duration;

    delete Subject1durationHr_txt.text;

    delete Subject1durationMin_txt.text;

    delete Subject1durationSec_txt.text;

    };

    I think you need to spend time by reducing your code at a practical level.  You seem to be any passage in the book in each function and I think that probably none of this is necessary.  If you have declared these variables at the beginning, then you don't need to transfer them to any function, because they are gobally available to one of the functions/code that follows.  Similarly, if you have some textfields on stage, it is pointless to pass those in all functions for the same reason.

    I see you doing the overuse of 'delete' (and possibly errant use as well).  Is probably the only thing you might want or need to use...

    delete Subjectxtimer_mc.onEnterFrame;

    Which stops the enterframe trigger activity, which I think is used to update the textfields which indicate the time.

    And that conditional uses == Nan is not likely to do anything except wonder what is a Nan.  TextFields hold the strings, which are cited.  SO unless you have a variable named Nan somewhere that has a value of string assigned to her, this condition will do nothing for you.  You probably don't need it at all if you get this working properly.

  • functions?

    Here's some code that I use to go back / play an animaion according to the rollover State. only ting is that I wish it were so that I could do something like:

    playFrames (homeBtn)...

    This way I can use it again and again the same function, but I don't know how to write it. I think its something like function playFrames (obj); and then do you something with this...

    "Home" button.
    homeBtn.onRollOver = function() {}
    {playFrames()}
    }
    homeBtn.onRollOut = function() {}
    rewindFrames();
    }
    function playFrames() {}
    onEnterFrame = function () {}
    If (_currentframe < 15) {}
    nextFrame();
    } else {}
    delete this.onEnterFrame;
    }
    };
    };
    function rewindFrames() {}
    onEnterFrame = function () {}
    If (homeBtn._currentframe > 1) {}
    homeBtn.prevFrame ();
    } else {}
    delete this.onEnterFrame;
    }
    };
    };

    If you mean that you want the buttons themselves to animate using a shared function, the following should work...

    homeBtn.onRollOver = otherBtn.onRollOver = function() {}
    playFrames (this);
    }

    homeBtn.onRollOut = otherBtn.onRollOut = function() {}
    rewindFrames (this);
    }

    function playFrames (btn) {}
    onEnterFrame = function () {}
    If (btn._currentframe<15)>
    btn.nextFrame ();
    } else {}
    delete this.onEnterFrame;
    }
    }
    }

    function rewindFrames (btn) {}
    onEnterFrame = function () {}
    If (btn._currentframe > 1) {}
    btn.prevFrame ();
    } else {}
    delete this.onEnterFrame;
    }
    }
    }

  • Why 2 loadNext functions are allowed in my script?

    Hello.  I'm pasting my full code now.  I have two functions that use loadNext.  How can I have that?  I do not quite understand and would greatly appreciate the help.  I put in bold the two sectors that use the function loadNext.

    I give "Good response" when I am helped, and 'Useful response' if the answer is simply useful took me.

    var currentSwf:Number = 0;
    var swfs:Array = new Array ("EZSmartStand/SmartStand.swf", "EZSmartStand/Warnings.swf", "EZSmartStand/LCDDisplay.swf", "EZSmartStand/Operation.swf", "EZSmartStand/Harness.swf", "EZSmartStand/Transferring.swf", "EZSmartStand/800lbvid.swf", "EZSmartStand/Ambulating.swf", "EZSmartStand/Accessories.swf", "EZSmartStand/HarnessLaundering.swf", "EZSmartStand/ChargingBatteries.swf", "EZSmartStand/EmergencyLowering.swf", "EZSmartStand/EmergencyLowering2.swf");

    var listener: Object = new Object();
    var mcl:MovieClipLoader = new MovieClipLoader();
    mcl.addListener (listener);

    When the SWF load, put in place to constantly check its current image
    against the total number of frames, and so those that match, the SWF is done playing.
    If this is the case, then load the following.

    listener.onLoadInit = {function(targ:MovieClip):Void}
    theTargetClip_mc.onEnterFrame = function (): Void {}
    If (this ._currentframe = this ._totalframes) {}
    loadNext();
    delete this.onEnterFrame;

    }
    }
    }

    Previous and next Swf button

    function loadNext (): Void {}
    currentSwf ++;
    If (currentSwf > = swfs.length) currentSwf = 0;
    loadSWF (currentSwf);
    }


    function loadSWF (nextSWFToLoad) {}
    mcl.loadClip (SWF [nextSWFToLoad], theTargetClip_mc);
    }

    loadSWF (currentSwf);

    function loadPrevious (): Void {}
    -currentSwf;
    if(currentSwf==-1) currentSwf = swfs.length - 1;
    loadSWF (currentSwf);
    }

    previous_btn.onRelease = loadPrevious;
    next_btn.onRelease = loadNext;

    Button to end previous and next to Swf

    'Play' button

    play_btn.onRelease = function() {}
    theTargetClip_mc.play ();
    }

    Pause button

    pause_btn.onRelease = function() {}
    theTargetClip_mc.stop ();
    }

    As I mentioned in my other response, now only need a loadNext.  The code simply calls the one you have, but it is not itself a function loadNext

Maybe you are looking for