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
Rescale Image
Puzzler II, Slide it!
Media Make & Go
CD Autorun
Fraction Scripts
Set DirectToStage Property of a Flash Member
MouseWheel
DM Transitions Pack 2
Color Picker
ShapeWindow Xtra
 

 

 

Behavior Power Blender

Added on 7/14/1999

 

Compatibilities:
behavior D7 D8 Mac PC

This item has not yet been rated

Author: BrianCassell

Blends sprite from 0 to 100% incrementally when mouse enters. Blends from current blend to 0 incrementally when mouse leaves.

--PowerBlender
--©1999 Brian Cassell

-----------------------------------
--Description
-----------------------------------

on getBehaviorDescription me
  return ¬
"PowerBlender Behavior"&RETURN&¬
"©1999 Brian Cassell, iXL (a cog in the machine)"&RETURN&RETURN&¬
"Blends sprite from 0 to 100 when mouse enters. Blends from current blend to 0 when mouse leaves."&RETURN&&RETURN&¬
"PARAMETERS:"&RETURN&¬
"*Sprite to fade:"&RETURN&¬
" The channel number of the sprite to fade. Default value is the sprite that the behavior is attached to."&RETURN&¬
" Can be attached to QuickDraw or other "trigger" sprites to affect a different sprite."&RETURN&¬
" Can attach the behavior multiple times to the same "trigger" sprite to affect multiple sprites."&RETURN&RETURN&¬
"*Blending speed:"&RETURN&¬
" Possible values are 10, 20, 50,100. Higher numbers indicate faster blends with fewer steps."
end

-----------------------------------
--Notes
-----------------------------------

--Written May, 24 1999
--The sprite to blend targeted by the "sprite to fade:" slider will have an initial blend value of 0
--regardless of the setting in the score window. The sprite will not flash as the value is set before
--the sprite is drawn to the stage during playback.

--Try appling the behavior multiple times to affect a number of sprites. You can change the speed
--on each one for some cool effects.

--Speed is a function of the FRAME RATE and the number you select in the "blending speed" dialouge.

-----------------------------------
--Properties
-----------------------------------

property spriteNum    --holds the number of the trigger sprite
property mySprite     --holds the number of the sprite to blend
property speed        --holds the blend percentage increments
property over         --flag for mouseOver, mouseLeave detection

-----------------------------------
--Event Handlers
-----------------------------------

on beginSprite me
  sprite(mySprite).blend = 0
end

on mouseEnter me
  set over = 1
end

on mouseLeave me
  set over = 0
end

on exitFrame me
  case over of
    1:blendUp
    0: blendDown
  end case
  
  -----------------------------------
  --Custom Handlers
  -----------------------------------
  
on blendDown
  if sprite(mySprite).blend > 0 then
    sprite(mySprite).blend = (sprite(mySprite).blend - speed)
  end if
end

on blendUp
  if sprite(mySprite).blend < 100 then
    sprite(mySprite).blend = (sprite(mySprite).blend + speed)
  end if
end

-----------------------------------
--Parameters
-----------------------------------

on getPropertyDescriptionList me
  set p_list = [ #mySprite:   [#comment:"Sprite to fade:", #format:#integer, #range: [#min:1, #max: 120], #default: the currentSpriteNum],¬
                 #speed:      [#comment:"Blending speed:", #format:#integer, #range: [10,20,50,100], #default:10]]
  return p_list
end

 


Contact

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

Send e-mail