Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
Direct Media Simple Control
MediaMacros
Impactica
Display The Windows Volume Control Slider
Simple Sprite Mover Behavior
PC Guard for Win32 Xtra
Orbital Slave
Video Status bar
Increase/ Decrease ViewScale Property of a Flash Sprite
Gravis MouseStick
 

 

 

Behavior Back Button - All In One

Added on 2/28/2000

 

Compatibilities:
behavior D6_5 D7 D8 Mac PC Shockwave

Rating:

Author: MediaMacros (website)

Drop this behavior on the framescript of each frame you want ot be included in the back button history. Also drop it on the back button and the script does the rest.

property spriteNum

global gBackList, gBack

on prepareFrame me
  if gBack = void then set gBack = false
  if gBackList = void then set gBackList = []
  if spriteNum < 1 then
    --framescript
    set totalBacks = count(gBackList)    
    if gBack = false then
      --did not come from back button        
      if totalBacks > 0 then
        set lastEntry = getAt(gBackList, totalBacks)
      else
        set lastEntry = ["", 0]
      end if
      if lastEntry <> [the moviePath & the movieName, the frame] then
        --not thecurrent frame, add tothe list
        add gBackList, [the moviePath & the movieName, the frame]
      end if
    else
      --came from the back button.  Remove last entry
      deleteAt(gBackList, totalBacks)
      set gBack = false  
    end if
  end if
end

on mouseUp me
  if gBack = void then set gBack = false
  if gBackList = void then set gBackList = []
  if spriteNum >= 1 then
    --is a button
    if count(gBackList) > 1 then
      --there are back locations
      set gBack = true
      set destination = getAt(gBackList, count(gBackList) - 1)
      if the moviePath & the movieName = getAt(destination, 1) then
        --same movie
        go to frame getAt(destination, 2)
      else
        --different movie
        go to frame getAt(destination, 2) of movie getAt(destination, 1)
      end if
    end if
  end if
end

on getBehaviorDescription me
  return "Drop this behavior on the framescript of each frame you want ot be included in the back button history.  Also drop it on the back button and the script does the rest."
end

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail