A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: onEnterFrame?

  1. #1
    Member
    Join Date
    Jul 2005
    Posts
    83

    onEnterFrame?

    Hi there,

    Im trying to make this thing - that when this keyframe is arrived at, that the film has two options depending on whether a global variable is true or not. If that variable is true, it stops() at that keyframe. If it isnt true, it goes to and plays ("printos"). Only I dont have a clue of the correct syntax - my best bet would be the one below, but it doesnt work. What would be the correct way to write this please?


    function.OnEnterFrame();
    if(_global.printer == false){
    gotoAndPlay("printos")
    {
    if(_global.printer == true){
    stop();
    }
    }
    Last edited by jopeiro; 04-27-2006 at 06:48 PM.

  2. #2
    Senior Member
    Join Date
    Jan 2006
    Location
    USA
    Posts
    383
    function onEnterFrame() {

    }

    or onEnterFrame = function() {

    }

    both work.

  3. #3
    Member
    Join Date
    Jul 2005
    Posts
    83
    hi, first off thanks for the reply.


    second, neither seem to work...i wonder where i messed up. Doesnt seem to gotoandplay "printos" when the variable is set to true

    function onEnterFrame() {
    if (_global.printer == true) {
    gotoAndPlay("printos");
    } else {
    stop();
    }
    };

    just stops at that frame i wrote it into in both cases..would you happen to know a way beyond this?

  4. #4
    Flashkit Veteran joejoe2288's Avatar
    Join Date
    Apr 2004
    Location
    Hickville, Oregon
    Posts
    2,554
    try this.onEnterFrame
    So tired of all the fighting....

    http://joejoe2288.kawanda.net

  5. #5
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    Must be some error is setting your variable..put a trace statement in and see what value you get for _global.printer.

    (Also if its a global variable you dont really need to put the _global in front to see what it's value is. Otherwise it kind of defeats the object of defining it as a global!!)

    anyway that aside:


    Code:
    function onEnterFrame() {
    trace(_global.printer);
    if (_global.printer == true) {
    gotoAndPlay("printos");
    } else {
    stop();
    }
    };
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  6. #6
    Member
    Join Date
    Jul 2005
    Posts
    83
    Hey thank you all!

    this.onEnterFrame();

    if (_global.printer == true) {
    _root.multipass.gotoAndPlay("printos");
    }
    if (_global.printer == false) {
    stop();

    }


    did it for me

  7. #7
    Senior Member
    Join Date
    Nov 2005
    Location
    dante's inferno
    Posts
    904
    I was going to say put quotes around true, but apparently you didnt have to.
    when you set a variable to either true or false, and then you check the variable to find the value, I always need to put it in quotes or it doesn't work
    code:

    var soundPlay = true;

    if (soundPlay == "true"){
    do whatever
    };


    if I don't put the quotes it appears it is trying to compare to the value of true, and not true itself.

    who knows
    IMS

  8. #8
    Senior Member
    Join Date
    Nov 2005
    Location
    dante's inferno
    Posts
    904
    actually, pretend I never posted in here, I have values in an xml that are true or false which then would need the quotes in the comparison because they come in as strings...
    i'm ready for this day to be over


    IMS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center