Code
& Behavior examples 1, 2, 3,
4, 5, 6
1 |
--activeX
control
property initialURl,
spriteNum
on beginSprite
-- init "Browser"
if (sprite
spriteNum).member.type
= #activeX then
initialURl="about:blank"
navigate((sprite
spriteNum), initialURl)
sendAllSprites(#IAmBrowser,
spriteNum)
end if
end
-- Can we go forward or back in activex
browser?
on CommandStateChange cmd, enable
if cmd = 2
then
if enable =
0 then
set
the visible
of sprite
5 to false
else
if
enable = -1 then
set
the visible
of sprite
5 to true
end
if
end if
else
if cmd = 1
then
if
enable = 0 then
set
the visible
of sprite
6 to false
else
if
enable = -1 then
set
the visible
of sprite
6 to true
end
if
end
if
end if
end if
end CommandStateChange |
|
|
2 |
--Get the next text,
quit projector if user defocuses
property tLastKey, Result
on enterFrame
Result = baActivateWindow(
baWinHandle() )
end
-- if (the key <> tLastKey or keypressed(tLastKey))
or (Result = 0)then
on beginsprite
tLastKey = the key
end
on exitframe
--get the text
theNetID = getNetText ("http://www.wsdot.wa.gov/pugetsoundtraffic/traveltimes/default.htm")
if netDone(theNetID)
= FALSE then
member("com").text
= netTextResult(theNetID)
go the
frame
end if
if sprite(18).blend=100
and ((the
mouseV>125)
or (the
mouseH<35)
or (the
mouseH>150))
then
sprite(18).blend=0
--move set sprites off the stage
sprite(21).locH=-958
sprite(22).locH=-958
sprite(23).locH=-958
sprite(24).locH=-958
end if
if (the
key <> tLastKey or
keypressed(tLastKey)) or
(Result = 0)
then
go "exit"
else
go the
frame
end if
end
|
|
|
3 |
--simulates a windows "Longhorn"
window appearance transition global
flipcount
property spriteNum,
pMySpriteRef
on beginSprite
me
pMySpriteRef = sprite(me.spriteNum)
currQuadList = sprite(pMySpriteRef).quad
currQuadList[3] = currQuadList[3]
- point(50,
0)
currQuadList[4] = currQuadList[4]
+ point(50,
0)
sprite(pMySpriteRef).quad
= currQuadList
sprite(pMySpriteRef).blend=0
updateStage
end
on enterFrame
me
currQuadList = sprite(pMySpriteRef).quad
repeat while
flipcount<50
currQuadList[3]
= currQuadList[3] + point(5,
0)
currQuadList[4]
= currQuadList[4] - point(5,
0)
sprite(pMySpriteRef).quad
= currQuadList
sprite(pMySpriteRef).blend=(flipcount*1.4)
+30
updateStage
flipcount=flipcount+5
end Repeat
=end |
|
|
4 |
--
A counter that will read write incremental +1 to a file
global fileText,
fileText2
on counter
-- Enter your file path &
the file name
filePath = "\\shelltest\cloaked\LHLive\back
up\" & "lhl_track.txt"
-- create a new instance of
the fileIO Xtra
fileIOInstance = xtra("FileIO").new()
-- error trap for missing file
Xtra
if not fileIOInstance.objectP
then
alert "File
IO Xtra missing"
exit
end if
-- open the file for reading
fileIOInstance.openFile(filePath, 0)
-- if the open is successful,
proceed. Otherwise I am surpressing error msgs, you can add an "Else..."
to the If statement
if fileIOInstance.status()
= 0 then
--read the value
fileText = fileIOInstance.readFile()
--make a value converting
the string (ie...("6") to numerical format (ie...6)
fileText2 = value(fileText)
--add 1 to counter
fileText2=fileText2+1
--Delete the exisitng
file, before rewriting it back with updated values
delete(fileIOInstance)
fileIOInstance.createFile(filePath)
fileIOInstance.openFile(filePath, 0)
--make a value converting
the numerical format (ie...6) to string (ie...("6")
fileText=string(fileText2)
--write the new file
and close it
writeString(fileIOInstance, fileText)
closefile(fileIOInstance)
end if
end |
|
|
5 |
-- 3 field variable
checking and updating for extensibility prototype
on beginSprite me listMin=1 listMax=theList.count end
on SpinUp listMin=1 repeat while listMin <= listMax put listmin if (theList[listMin]<>counter2 and theList[listMin]<>counter3) and (theList[listMin]> counter) then counter=theList[listMin] listMin=listMin+1 else if counter+1<>counter2 and counter+1<>counter3 and counter+1 <=3 then counter=counter+1 -- listMin=listMin+1 exit repeat else listMin=listMin+1 end if end if end Repeat
if counter=0 then put "none" into member("field_txt")
if switch=1 then put "none" into member("field_txtA") put "none" into member("field_txtB") counterA=0 counterB=0 end if else put counter into member("field_txt") if switch=1 then put counter into member("field_txtA") put counter into member("field_txtB") counterA=counter counterB=counter end if end if
end
on SpinDown listMin=1 repeat while listMin <= listMax if (theList[listMin]<>counter2 and theList[listMin]<>counter3) and (theList[listMin]< counter) then counter=theList[listMin] listMin=listMin+1 else if counter-1<>counter2 and counter-1<>counter3 and counter-1 >=0 then counter=counter-1 -- listMin=listMin+1 exit repeat else listMin=listMin+1 end if end if end Repeat
if counter=0 then put "none" into member("field_txt")
if switch=1 then put "none" into member("field_txtA") put "none" into member("field_txtB") counterA=0 counterB=0 end if else put counter into member("field_txt") if switch=1 then put counter into member("field_txtA") put counter into member("field_txtB") counterA=counter counterB=counter end if end if
end
|
|
|
6 |
--list
functions, push/pop values & re-sort functions
global form,
ms, xb, down, down2
property a, a2, temp, temp2, temp_sort,
temp_loc, name
on mouseUp()
if ms=1
then
xb=0
name="espn"
end if
if xb=1
then
ms=0
name="xb"
end if
a=getPos(form, name)
a2=findPos(form, a)
temp=findPos(form, a+1)
if temp<=10
then
temp2=getaProp(form,
temp)
deleteProp(form,
temp)
deleteProp(form,
a2)
addProp(form,
a2, temp2)
addProp(form,
temp, name)
form.sort()
else
temp=10
end if
put "position",temp
if ms=1
or xb=1
then
if temp<=10
then
theList = [1,2,3,4,5,6,7,8,9,10]
repeat
with i in
theList
temp_sort=getaProp(form,
i)
temp_loc=211+(i*28)
if
temp_sort="al" then
sprite(24).locV=temp_loc
else
if
temp_sort="ex" then
sprite(25).locV=temp_loc
else
if
temp_sort="cnbc" then
sprite(26).locV=temp_loc
else
if
temp_sort="exp" then
sprite(27).locV=temp_loc
else
if
temp_sort="tr" then
sprite(28).locV=temp_loc
else
if
temp_sort="bar" then
sprite(29).locV=temp_loc
else
if
temp_sort="game" then
sprite(30).locV=temp_loc
else
if
temp_sort="espn" then
sprite(31).locV=temp_loc
else
if
temp_sort="ms" then
sprite(32).locV=temp_loc
else
if
temp_sort="xb" then
sprite(33).locV=temp_loc
end
if
end
if
end
if
end
if
end
if
end
if
end
if
end
if
end
if
end
if
end
repeat
sprite
(a+34+1).blend=50
sprite
(a+34).blend=0
down=0
down2=0
if
temp=10 and
(ms=1 or
xb=1) then
sprite
(temp+34).blend=50
end
if
end if
end if
end mouseUp
|
|
|
|