Fenêtre extensible animée + mask
Hello
Tutorial pouvant être utilisé pour le stage ( scène ) ou en MIAW ( fenêtre )
l'exemple ici ne montre pas comment utiliser des MIAW, sujet mainte fois abordé sur le forum director
voici une version contenant deux masques.
Le 1er pour la petite taille et le second pour la grande taille)
présentation des 2 masques ( couleur 1 bit, noir et blanc )
la fenêtre dans son état par défaut. ( masque appliqué, n°1 )
on clique sur le bouton, la fenêtre s'élargie en incrémentation de 5 pixels ( 5 étant la vitesse d'élargissement de la fenêtre, augmentez ou diminuez la vitesse selon vos préférences )
La flèche noire montre le mouvement une fois le bouton activé/désactivé. ( masque appliqué n°2 )
script sur le bouton vert
-- Expand Anim Window + mask ----------------------------- -- Script by Laurent Leedoriden -- Copyright © 1996 - 2005 Leedoriden DSFW -- All rights reserved -- created : 06/29/2005 -- last updated : ---------------------------- property pListImg, pDown, pInc property pLargeurBarre, pLocHBtnExit, pLargeurBtnExit, pLocHRightBarre, pLargeurRightBarre on beginsprite me pDown = 0 pInc = 0 pListImg = ["btnup_op","btndo_op"] pLargeurBarre = sprite("barre").width pLocHRightBarre = sprite("RightBarre").loch pLargeurRightBarre = sprite("RightBarre").width pLocHBtnExit = sprite("BtnExit").loch pLargeurBtnExit = sprite("BtnExit").width end on mouseup me pDown = 1 - pDown if pDown then sprite(me.spritenum).member = pListImg[2] -- syntaxe MX2004 window("stage").appearanceoptions.mask = member("big mask") -------------------------------------- -- syntaxe avant MX2004 -- window("stage").windowtype = member("big mask") -------------------------------------- me.prepareframe() else sprite(me.spritenum).member = pListImg[1] me.prepareframe() end if end on prepareframe me if pDown then pInc = pInc +5 if pInc >= 600 then pInc = 600 me.ExpandWindow(pInc) -- expand window horizontal else pInc = pInc -5 if pInc <= 300 then pInc = 300 -- syntaxe MX2004 window("stage").appearanceoptions.mask = member("small mask") -------------------------------------- -- syntaxe avant MX2004 -- window("stage").windowtype = member("small mask") -------------------------------------- end if me.ExpandWindow(pInc) -- expand window horizontal end if end on ExpandWindow(me, WindowSize) WindowRect = (the activewindow).rect WindowWidth = WindowRect.width WindowHeight = WindowRect.height WindowTop = WindowRect.top WindowLeft = WindowRect.left -- WindowWidth = WindowSize -- largeur modifiée NewRect = rect(0,0, WindowWidth, WindowHeight) NewRect = NewRect.offset(WindowLeft, WindowTop) (the activewindow).rect = NewRect -- positionner : barre de titre, bouton exit, pLargeurBarre = (WindowWidth - pLargeurRightBarre) - pLargeurRightBarre sprite("barre").width = pLargeurBarre pLocHRightBarre = pLargeurBarre + pLargeurRightBarre sprite("RightBarre").loch = pLocHRightBarre pLocHBtnExit = (WindowWidth - (pLargeurRightBarre + pLargeurBtnExit)) sprite("BtnExit").loch = pLocHBtnExit end
pour les versions antérieures à MX2004, il faut ajouter, un script d'animation pour déterminer le 1er masque ( petite taille )
on startmovie window("stage").windowtype = member("small mask") end
vous remarquerez que cet exemple s'applique sur la scène ( stage ) pour l'appliquer à une MIAW,
remplacez window(“stage”) par le nom de la fenêtre MIAW,
comme ceci : window(“NomFenetreMIAW”)
tuto by Leedoriden
