Bonjour , je voudrais intercepter n'importe quel click souris pendnat
mon animation, que ce soit sur une image objet avec un script ou sur
ma scene pour cela je cree un script d'animation avec un evenement on
mouseDown mais cela omet des evenements ...
Bonjour , je voudrais intercepter n'importe quel click souris pendnat
mon animation, que ce soit sur une image objet avec un script ou sur
ma scene pour cela je cree un script d'animation avec un evenement on
mouseDown mais cela omet des evenements ...
Bonjour , je voudrais intercepter n'importe quel click souris pendnat
mon animation, que ce soit sur une image objet avec un script ou sur
ma scene pour cela je cree un script d'animation avec un evenement on
mouseDown mais cela omet des evenements ...
Bonjour , je voudrais intercepter n'importe quel click souris pendnat mon
animation, que ce soit sur une image objet avec un script ou sur ma scene
pour cela je cree un script d'animation avec un evenement on mouseDown
mais cela omet des evenements ...
Bonjour , je voudrais intercepter n'importe quel click souris pendnat mon
animation, que ce soit sur une image objet avec un script ou sur ma scene
pour cela je cree un script d'animation avec un evenement on mouseDown
mais cela omet des evenements ...
Bonjour , je voudrais intercepter n'importe quel click souris pendnat mon
animation, que ce soit sur une image objet avec un script ou sur ma scene
pour cela je cree un script d'animation avec un evenement on mouseDown
mais cela omet des evenements ...
Le Fri, 16 Apr 2004 11:14:03 +0200, Mas Fabien a écrit:
> Bonjour , je voudrais intercepter n'importe quel click souris pendnat
> animation, que ce soit sur une image objet avec un script ou sur ma
> pour cela je cree un script d'animation avec un evenement on mouseDown
> mais cela omet des evenements ...
salut Fabien.
Une autre approche, un peu plus lourde, mais qu ia l'avantage de ne pas
nécessiter la moindre modif dans les scripts existants, et l'utilisation
d'un objet qui va 'écouter' les clics de souris.
Voici un script parent, rapidement adapté d'un autre que j'utilise
intensément, et qui doit faire (avec peut-être quelques corrections) cette
écoute. Les deux dernières méthodes sont appellées lorsqu'un mouseUp ou un
mouseDown survient.
bonne journée
séb
-- script parent "PS_mouseDown trapping"
--================================================= > -- DEPENDENCIES
--================================================= > -- none ;¬)
-- API
-- * new(
-- * mKill()
-- sample :
-- oMouseWatcher = script("PS_mouseDown trapping").new()
--================================================= > -- GLOBALS
--================================================= > global g, gSp, gL
--================================================= > -- PROPERTIES
--================================================= > property ancestor
property pnChannel
property pbWasClicked, pbClickDone
property ptoStopMovieCatcher
----------------------------------------------------------------------
---- CONSTRUCTOR ---- CONSTRUCTOR *
on _____________________CONSTRUCTOR_________________________________()
on new (me, params)
if me.miInit(params) then return me
end
on stopMovie me
--> send by the timeout
me.mKill()
end
on mKill (me)
me.miKill()
end
on stepFrame me
if the mouseDown then
-- mouseDown?
if NOT pbWasClicked then me.miStartClick()
else
-- mouseUp?
if pbWasClicked then me.miStopClick()
end if
end
----------------------------------------------------------------------
---- PRIVATE METHODS ---- PRIVATE *
on _____________________PRIVATE_METHODS___________________________()
on miInit (me, nSpriteChannel) ---------------------------------------
-- PRIVATE
-- > new
--
-- INPUTS:
-- nSpriteChannel <#integer> : the sprite channel to trap mouse
-- events for.
-------
if not integerP(nSpriteChannel) then return FALSE
pnChannel = nSpriteChannel
(the actorList).add(me)
ptoStopMovieCatcher = timeout("stopMovie"&me.string).new(the
#dummy, me)
return TRUE
end -- miInit handler
on miKill (me) -------------------------------------------------------
-- PRIVATE
-- > mKill
-------
if not voidP(ptoStopMovieCatcher) then
ptoStopMovieCatcher.target = VOID
ptoStopMovieCatcher.forget()
ptoStopMovieCatcher = VOID
end if
(the actorList).deleteOne(me)
end -- miKill handler
on miStartClick (me) -------------------------------------------------
-- PRIVATE
--> stepFrame
-------
pbWasClicked = TRUE
lInfos = propList()
lInfos[#frame] = the frame
lInfos[#spriteNum] = the clickOn
lInfos[#loc] = the clickLoc
lInfos[#timeStamp] = the milliseconds
-- toutes les infos sur le mouseDown sont contenues dans la liste
pbClickDone = TRUE
end -- miStartClick handler
on miStopClick (me) --------------------------------------------------
-- PRIVATE
--> stepFrame
-------
if pbWasClicked then
lInfos = propList()
lInfos[#frame] = the frame
lInfos[#spriteNum] = the clickOn
lInfos[#loc] = the mouseLoc
lInfos[#timeStamp] = the milliseconds
-- toutes les infos sur le mouseUp sont contenues dans la liste
pbWasClicked = FALSE
end if
pbClickDone = FALSE
end -- miStopClick handler
on _____________________END_OF_OBJECT_____________________ ()
on _______________________________________________________________()
end
Le Fri, 16 Apr 2004 11:14:03 +0200, Mas Fabien <fabien@iom.fr> a écrit:
> Bonjour , je voudrais intercepter n'importe quel click souris pendnat
> animation, que ce soit sur une image objet avec un script ou sur ma
> pour cela je cree un script d'animation avec un evenement on mouseDown
> mais cela omet des evenements ...
salut Fabien.
Une autre approche, un peu plus lourde, mais qu ia l'avantage de ne pas
nécessiter la moindre modif dans les scripts existants, et l'utilisation
d'un objet qui va 'écouter' les clics de souris.
Voici un script parent, rapidement adapté d'un autre que j'utilise
intensément, et qui doit faire (avec peut-être quelques corrections) cette
écoute. Les deux dernières méthodes sont appellées lorsqu'un mouseUp ou un
mouseDown survient.
bonne journée
séb
-- script parent "PS_mouseDown trapping"
--================================================= > -- DEPENDENCIES
--================================================= > -- none ;¬)
-- API
-- * new(
-- * mKill()
-- sample :
-- oMouseWatcher = script("PS_mouseDown trapping").new()
--================================================= > -- GLOBALS
--================================================= > global g, gSp, gL
--================================================= > -- PROPERTIES
--================================================= > property ancestor
property pnChannel
property pbWasClicked, pbClickDone
property ptoStopMovieCatcher
----------------------------------------------------------------------
---- CONSTRUCTOR ---- CONSTRUCTOR *
on _____________________CONSTRUCTOR_________________________________()
on new (me, params)
if me.miInit(params) then return me
end
on stopMovie me
--> send by the timeout
me.mKill()
end
on mKill (me)
me.miKill()
end
on stepFrame me
if the mouseDown then
-- mouseDown?
if NOT pbWasClicked then me.miStartClick()
else
-- mouseUp?
if pbWasClicked then me.miStopClick()
end if
end
----------------------------------------------------------------------
---- PRIVATE METHODS ---- PRIVATE *
on _____________________PRIVATE_METHODS___________________________()
on miInit (me, nSpriteChannel) ---------------------------------------
-- PRIVATE
-- > new
--
-- INPUTS:
-- nSpriteChannel <#integer> : the sprite channel to trap mouse
-- events for.
-------
if not integerP(nSpriteChannel) then return FALSE
pnChannel = nSpriteChannel
(the actorList).add(me)
ptoStopMovieCatcher = timeout("stopMovie"&me.string).new(the
#dummy, me)
return TRUE
end -- miInit handler
on miKill (me) -------------------------------------------------------
-- PRIVATE
-- > mKill
-------
if not voidP(ptoStopMovieCatcher) then
ptoStopMovieCatcher.target = VOID
ptoStopMovieCatcher.forget()
ptoStopMovieCatcher = VOID
end if
(the actorList).deleteOne(me)
end -- miKill handler
on miStartClick (me) -------------------------------------------------
-- PRIVATE
--> stepFrame
-------
pbWasClicked = TRUE
lInfos = propList()
lInfos[#frame] = the frame
lInfos[#spriteNum] = the clickOn
lInfos[#loc] = the clickLoc
lInfos[#timeStamp] = the milliseconds
-- toutes les infos sur le mouseDown sont contenues dans la liste
pbClickDone = TRUE
end -- miStartClick handler
on miStopClick (me) --------------------------------------------------
-- PRIVATE
--> stepFrame
-------
if pbWasClicked then
lInfos = propList()
lInfos[#frame] = the frame
lInfos[#spriteNum] = the clickOn
lInfos[#loc] = the mouseLoc
lInfos[#timeStamp] = the milliseconds
-- toutes les infos sur le mouseUp sont contenues dans la liste
pbWasClicked = FALSE
end if
pbClickDone = FALSE
end -- miStopClick handler
on _____________________END_OF_OBJECT_____________________ ()
on _______________________________________________________________()
end
Le Fri, 16 Apr 2004 11:14:03 +0200, Mas Fabien a écrit:
> Bonjour , je voudrais intercepter n'importe quel click souris pendnat
> animation, que ce soit sur une image objet avec un script ou sur ma
> pour cela je cree un script d'animation avec un evenement on mouseDown
> mais cela omet des evenements ...
salut Fabien.
Une autre approche, un peu plus lourde, mais qu ia l'avantage de ne pas
nécessiter la moindre modif dans les scripts existants, et l'utilisation
d'un objet qui va 'écouter' les clics de souris.
Voici un script parent, rapidement adapté d'un autre que j'utilise
intensément, et qui doit faire (avec peut-être quelques corrections) cette
écoute. Les deux dernières méthodes sont appellées lorsqu'un mouseUp ou un
mouseDown survient.
bonne journée
séb
-- script parent "PS_mouseDown trapping"
--================================================= > -- DEPENDENCIES
--================================================= > -- none ;¬)
-- API
-- * new(
-- * mKill()
-- sample :
-- oMouseWatcher = script("PS_mouseDown trapping").new()
--================================================= > -- GLOBALS
--================================================= > global g, gSp, gL
--================================================= > -- PROPERTIES
--================================================= > property ancestor
property pnChannel
property pbWasClicked, pbClickDone
property ptoStopMovieCatcher
----------------------------------------------------------------------
---- CONSTRUCTOR ---- CONSTRUCTOR *
on _____________________CONSTRUCTOR_________________________________()
on new (me, params)
if me.miInit(params) then return me
end
on stopMovie me
--> send by the timeout
me.mKill()
end
on mKill (me)
me.miKill()
end
on stepFrame me
if the mouseDown then
-- mouseDown?
if NOT pbWasClicked then me.miStartClick()
else
-- mouseUp?
if pbWasClicked then me.miStopClick()
end if
end
----------------------------------------------------------------------
---- PRIVATE METHODS ---- PRIVATE *
on _____________________PRIVATE_METHODS___________________________()
on miInit (me, nSpriteChannel) ---------------------------------------
-- PRIVATE
-- > new
--
-- INPUTS:
-- nSpriteChannel <#integer> : the sprite channel to trap mouse
-- events for.
-------
if not integerP(nSpriteChannel) then return FALSE
pnChannel = nSpriteChannel
(the actorList).add(me)
ptoStopMovieCatcher = timeout("stopMovie"&me.string).new(the
#dummy, me)
return TRUE
end -- miInit handler
on miKill (me) -------------------------------------------------------
-- PRIVATE
-- > mKill
-------
if not voidP(ptoStopMovieCatcher) then
ptoStopMovieCatcher.target = VOID
ptoStopMovieCatcher.forget()
ptoStopMovieCatcher = VOID
end if
(the actorList).deleteOne(me)
end -- miKill handler
on miStartClick (me) -------------------------------------------------
-- PRIVATE
--> stepFrame
-------
pbWasClicked = TRUE
lInfos = propList()
lInfos[#frame] = the frame
lInfos[#spriteNum] = the clickOn
lInfos[#loc] = the clickLoc
lInfos[#timeStamp] = the milliseconds
-- toutes les infos sur le mouseDown sont contenues dans la liste
pbClickDone = TRUE
end -- miStartClick handler
on miStopClick (me) --------------------------------------------------
-- PRIVATE
--> stepFrame
-------
if pbWasClicked then
lInfos = propList()
lInfos[#frame] = the frame
lInfos[#spriteNum] = the clickOn
lInfos[#loc] = the mouseLoc
lInfos[#timeStamp] = the milliseconds
-- toutes les infos sur le mouseUp sont contenues dans la liste
pbWasClicked = FALSE
end if
pbClickDone = FALSE
end -- miStopClick handler
on _____________________END_OF_OBJECT_____________________ ()
on _______________________________________________________________()
end
Voici un script parent, rapidement adapté d'un autre que j'utilise
intensément, et qui doit faire (avec peut-être quelques corrections)
cette écoute. Les deux dernières méthodes sont appellées lorsqu'un
mouseUp ou un mouseDown survient.
bonne journée
séb
-- script parent "PS_mouseDown trapping"
--================================================= > -- DEPENDENCIES
--================================================= > -- none ;¬)
-- API
-- * new(
-- * mKill()
-- sample :
-- oMouseWatcher = script("PS_mouseDown trapping").new()
--================================================= > -- GLOBALS
--================================================= > global g, gSp, gL
--================================================= > -- PROPERTIES
--================================================= > property ancestor
property pnChannel
property pbWasClicked, pbClickDone
property ptoStopMovieCatcher
----------------------------------------------------------------------
---- CONSTRUCTOR ---- CONSTRUCTOR *
on _____________________CONSTRUCTOR_________________________________()
on new (me, params)
if me.miInit(params) then return me
end
on stopMovie me
--> send by the timeout
me.mKill()
end
on mKill (me)
me.miKill()
end
on stepFrame me
if the mouseDown then
-- mouseDown?
if NOT pbWasClicked then me.miStartClick()
else
-- mouseUp?
if pbWasClicked then me.miStopClick()
end if
end
----------------------------------------------------------------------
---- PRIVATE METHODS ---- PRIVATE *
on _____________________PRIVATE_METHODS___________________________()
on miInit (me, nSpriteChannel) ---------------------------------------
-- PRIVATE
-- > new
--
-- INPUTS:
-- nSpriteChannel <#integer> : the sprite channel to trap mouse
-- events for.
-------
if not integerP(nSpriteChannel) then return FALSE
pnChannel = nSpriteChannel
(the actorList).add(me)
ptoStopMovieCatcher = timeout("stopMovie"&me.string).new(the
maxInteger, #dummy, me)
return TRUE
end -- miInit handler
on miKill (me) -------------------------------------------------------
-- PRIVATE
-- > mKill
-------
if not voidP(ptoStopMovieCatcher) then
ptoStopMovieCatcher.target = VOID
ptoStopMovieCatcher.forget()
ptoStopMovieCatcher = VOID
end if
(the actorList).deleteOne(me)
end -- miKill handler
on miStartClick (me) -------------------------------------------------
-- PRIVATE
--> stepFrame
-------
pbWasClicked = TRUE
lInfos = propList()
lInfos[#frame] = the frame
lInfos[#spriteNum] = the clickOn
lInfos[#loc] = the clickLoc
lInfos[#timeStamp] = the milliseconds
-- toutes les infos sur le mouseDown sont contenues dans la liste
lInfos
pbClickDone = TRUE
end -- miStartClick handler
on miStopClick (me) --------------------------------------------------
-- PRIVATE
--> stepFrame
-------
if pbWasClicked then
lInfos = propList()
lInfos[#frame] = the frame
lInfos[#spriteNum] = the clickOn
lInfos[#loc] = the mouseLoc
lInfos[#timeStamp] = the milliseconds
-- toutes les infos sur le mouseUp sont contenues dans la liste
lInfos
pbWasClicked = FALSE
end if
pbClickDone = FALSE
end -- miStopClick handler
on _____________________END_OF_OBJECT_____________________ ()
on _______________________________________________________________()
end
Voici un script parent, rapidement adapté d'un autre que j'utilise
intensément, et qui doit faire (avec peut-être quelques corrections)
cette écoute. Les deux dernières méthodes sont appellées lorsqu'un
mouseUp ou un mouseDown survient.
bonne journée
séb
-- script parent "PS_mouseDown trapping"
--================================================= > -- DEPENDENCIES
--================================================= > -- none ;¬)
-- API
-- * new(
-- * mKill()
-- sample :
-- oMouseWatcher = script("PS_mouseDown trapping").new()
--================================================= > -- GLOBALS
--================================================= > global g, gSp, gL
--================================================= > -- PROPERTIES
--================================================= > property ancestor
property pnChannel
property pbWasClicked, pbClickDone
property ptoStopMovieCatcher
----------------------------------------------------------------------
---- CONSTRUCTOR ---- CONSTRUCTOR *
on _____________________CONSTRUCTOR_________________________________()
on new (me, params)
if me.miInit(params) then return me
end
on stopMovie me
--> send by the timeout
me.mKill()
end
on mKill (me)
me.miKill()
end
on stepFrame me
if the mouseDown then
-- mouseDown?
if NOT pbWasClicked then me.miStartClick()
else
-- mouseUp?
if pbWasClicked then me.miStopClick()
end if
end
----------------------------------------------------------------------
---- PRIVATE METHODS ---- PRIVATE *
on _____________________PRIVATE_METHODS___________________________()
on miInit (me, nSpriteChannel) ---------------------------------------
-- PRIVATE
-- > new
--
-- INPUTS:
-- nSpriteChannel <#integer> : the sprite channel to trap mouse
-- events for.
-------
if not integerP(nSpriteChannel) then return FALSE
pnChannel = nSpriteChannel
(the actorList).add(me)
ptoStopMovieCatcher = timeout("stopMovie"&me.string).new(the
maxInteger, #dummy, me)
return TRUE
end -- miInit handler
on miKill (me) -------------------------------------------------------
-- PRIVATE
-- > mKill
-------
if not voidP(ptoStopMovieCatcher) then
ptoStopMovieCatcher.target = VOID
ptoStopMovieCatcher.forget()
ptoStopMovieCatcher = VOID
end if
(the actorList).deleteOne(me)
end -- miKill handler
on miStartClick (me) -------------------------------------------------
-- PRIVATE
--> stepFrame
-------
pbWasClicked = TRUE
lInfos = propList()
lInfos[#frame] = the frame
lInfos[#spriteNum] = the clickOn
lInfos[#loc] = the clickLoc
lInfos[#timeStamp] = the milliseconds
-- toutes les infos sur le mouseDown sont contenues dans la liste
lInfos
pbClickDone = TRUE
end -- miStartClick handler
on miStopClick (me) --------------------------------------------------
-- PRIVATE
--> stepFrame
-------
if pbWasClicked then
lInfos = propList()
lInfos[#frame] = the frame
lInfos[#spriteNum] = the clickOn
lInfos[#loc] = the mouseLoc
lInfos[#timeStamp] = the milliseconds
-- toutes les infos sur le mouseUp sont contenues dans la liste
lInfos
pbWasClicked = FALSE
end if
pbClickDone = FALSE
end -- miStopClick handler
on _____________________END_OF_OBJECT_____________________ ()
on _______________________________________________________________()
end
Voici un script parent, rapidement adapté d'un autre que j'utilise
intensément, et qui doit faire (avec peut-être quelques corrections)
cette écoute. Les deux dernières méthodes sont appellées lorsqu'un
mouseUp ou un mouseDown survient.
bonne journée
séb
-- script parent "PS_mouseDown trapping"
--================================================= > -- DEPENDENCIES
--================================================= > -- none ;¬)
-- API
-- * new(
-- * mKill()
-- sample :
-- oMouseWatcher = script("PS_mouseDown trapping").new()
--================================================= > -- GLOBALS
--================================================= > global g, gSp, gL
--================================================= > -- PROPERTIES
--================================================= > property ancestor
property pnChannel
property pbWasClicked, pbClickDone
property ptoStopMovieCatcher
----------------------------------------------------------------------
---- CONSTRUCTOR ---- CONSTRUCTOR *
on _____________________CONSTRUCTOR_________________________________()
on new (me, params)
if me.miInit(params) then return me
end
on stopMovie me
--> send by the timeout
me.mKill()
end
on mKill (me)
me.miKill()
end
on stepFrame me
if the mouseDown then
-- mouseDown?
if NOT pbWasClicked then me.miStartClick()
else
-- mouseUp?
if pbWasClicked then me.miStopClick()
end if
end
----------------------------------------------------------------------
---- PRIVATE METHODS ---- PRIVATE *
on _____________________PRIVATE_METHODS___________________________()
on miInit (me, nSpriteChannel) ---------------------------------------
-- PRIVATE
-- > new
--
-- INPUTS:
-- nSpriteChannel <#integer> : the sprite channel to trap mouse
-- events for.
-------
if not integerP(nSpriteChannel) then return FALSE
pnChannel = nSpriteChannel
(the actorList).add(me)
ptoStopMovieCatcher = timeout("stopMovie"&me.string).new(the
maxInteger, #dummy, me)
return TRUE
end -- miInit handler
on miKill (me) -------------------------------------------------------
-- PRIVATE
-- > mKill
-------
if not voidP(ptoStopMovieCatcher) then
ptoStopMovieCatcher.target = VOID
ptoStopMovieCatcher.forget()
ptoStopMovieCatcher = VOID
end if
(the actorList).deleteOne(me)
end -- miKill handler
on miStartClick (me) -------------------------------------------------
-- PRIVATE
--> stepFrame
-------
pbWasClicked = TRUE
lInfos = propList()
lInfos[#frame] = the frame
lInfos[#spriteNum] = the clickOn
lInfos[#loc] = the clickLoc
lInfos[#timeStamp] = the milliseconds
-- toutes les infos sur le mouseDown sont contenues dans la liste
lInfos
pbClickDone = TRUE
end -- miStartClick handler
on miStopClick (me) --------------------------------------------------
-- PRIVATE
--> stepFrame
-------
if pbWasClicked then
lInfos = propList()
lInfos[#frame] = the frame
lInfos[#spriteNum] = the clickOn
lInfos[#loc] = the mouseLoc
lInfos[#timeStamp] = the milliseconds
-- toutes les infos sur le mouseUp sont contenues dans la liste
lInfos
pbWasClicked = FALSE
end if
pbClickDone = FALSE
end -- miStopClick handler
on _____________________END_OF_OBJECT_____________________ ()
on _______________________________________________________________()
end