Imaging lingo #1

June 11, 2009

How to detect a clickable area (coloured grey in this instance) inside an image sprite (back color is black)

on mouseleave me
cursor 0
end

on mouseenter me
thename= sprite(me.spritenum).member.name
theimage=member(thename).image
end

on mousewithin me
thename=sprite(me.spritenum).member.name
pointinmember= sprite(me.spritenum).mapstagetomember(_mouse.mouseloc)
theimage=member(thename).image
thepix=theimage.getpixel(pointinmember)
if thepix=color( 128, 128, 128 ) then
cursor 3
else
cursor 0
end if
end

<3 imaging lingo!!111 ;D


Resizeable video

March 17, 2009

Code (director lingo)for resizing a Miaw video window (movie is set to fill window size at all times but you can also modify and scale as you like :) )

Works on resize, maximize, restore, minimize and everything else that’s a little bit of a laugh ;D

Video sprite is sprite (1)

Exit frame script

on exitFrame me

thewin=_movie.name
therect=window(thewin).rect
member(“stats”).text=”window: “&&therect && “vid: “&&string(sprite(1).rect) && string(sprite(1).top) && string(sprite(1).left) && string(sprite(1).height)&&string(sprite(1).width)
– sprite(1).rect=therect

sprite(1).top=0
updatestage
sprite(1).left=0
updatestage
go to the frame
end

——-movie scripts

on closewindow
thewin=_movie.name
window(thewin).close()
window(thewin).forget()

end

on movewindow
thewin=_movie.name
hideicons
– thewin=_movie.name
–  therect=window(thewin).rect
–  thewidth=therect.right – therect.left
–  theheight=therect.bottom – therect.top
–    sprite(1).loch=0
–  sprite(1).locv=0

–  sprite(1).height=theheight
–  sprite(1).width=thewidth

updatestage

end

on resizewindow
thewin=_movie.name
therect=window(thewin).rect
thewidth=therect.right – therect.left
theheight=therect.bottom – therect.top

sprite(1).width=thewidth*2
sprite(1).height=theheight*2
updatestage
sprite(1).loch=0
sprite(1).locv=0
updatestage

—-get window rect
—extract size
—set sprite size
—set sprite position

end

on zoomwindow
thewin=_movie.name
sprite(1).rect=window(thewin).rect
hideicons
sprite(1).top=0
updatestage
sprite(1).left=0
updatestage

end

Phew glad that’s over and done with.

Now to figure out why i hae to multiply by two to get the proper result when values are fine as they are … :/

Edit:

Ok i was stupid… You have to multiply by 2 IF and ONLY IF the regpoint of the video sprite is in the middle instead of 0,0 (sometimes things make too much sense to be able to understand them :p)


When calculating %s

July 9, 2008

remember to use float variables instead of using integers and wondering why it just wont work.

It also helps if you are not in retard mode when doing so ;p


PDL template

May 26, 2008

Standard property description list generation template :
on getpropertydescriptionlist me
thelist=[:]
addprop thelist, #temp, [#comment:"temp", #format:#string, #default:"", #range:["option1","option2","option3"]]
addprop thelist, #temp1, [#comment:"temp1", #format:#integer, #default:0, #range:[0,1,2,3,4,5]]

return thelist
end getpropertydescriptionlist me

Or if you want a full definition in one line (neat n tidy but a bitch to modify especially for longer lists ;p )

on getpropertydescriptionlist me
thelist=[#temp1:[#comment:"temp1", #format:#string, #default:"", #range:["option1","option2","option3"]], #Temp2:[#comment:"temp2", #format:#integer, #default:#1, #range:[#min:1, #max:10]]]

return thelist
end getpropertydescriptionlist me

Copy / paste / modify / dun :D


Disappearing scrollbars?

May 22, 2008

Apparently creating the executable file in Shockwave mode (used for stub projectors mostly) will make your scrollbars disappear. There… 4 hours of your time saved and 4 hours of mine wasted.