• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How do I detect the Previous Frame in a if/then statement?

Engaged ,
May 07, 2012 May 07, 2012

Copy link to clipboard

Copied

I am attempting to instill certain conditions based on where the play head has been. In the code below, I would like to check if the previous frame was frame 6. If so, then something should happen. I get an error saying "Target of assignment must be a reference value."

//Check certain conditions and adds the appropriate movie clip.

if (prevFrame() = "6")

{

    addChild(page4_xText_2);

    page4_xText_2.x = 223;

    page4_xText_2.y = 51;

    bnt_forwardPage_5b.visible = true;

    bnt_backPage_5b.visible = true;

}

else

{

    addChild(page4_xText_1);

    page4_xText_1.x = 203;

    page4_xText_1.y = 103;

    bnt_forwardPage_5.visible = true;

    bnt_backPage_5.visible = true;

}

Any suggestions?

TOPICS
ActionScript

Views

528

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 07, 2012 May 07, 2012

Copy link to clipboard

Copied

LATEST

You have a lot of problems there.

That specific error is because you are tyring to assign the string "6" to a function called prevFrame(). What you want inside of if statements is the comparison operator == not the asignment operator =.

BUT that won't fix your problem either. prevFrame() isn't what you think it is. It is a method (function) of the MovieClip class that tells the playhead to goto the previous frame. If your movie is playing normally, then all you need to know is

if(currentFrame==7)

If your movie is playing in some kind of random order then you will need to make a way of keeping track of which frames and then use that technique to know. There is no built in way of knowing which frame was played before the current frame.

Or, when you get to frame six you could tell flash to wait one more frame and then do something.

Whatever it is that you are actually trying to do, there is probably a different and easier way to do it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines