A
download dynapi.fx.motionx.html
Language: NonCode
LOC: 0
Project Info
DynAPI
Server: SourceForge
Type: cvs
...i\dynapi\dynapi3x\examples\
   datasource-paging.db
   datasource.db
   ...cross_frame_access.html
   ...me_access_-_frame1.html
   ...me_access_-_frame2.html
   ...dragdrop-collision.html
   demo.dragicon.html
   demo.dragover.html
   demo.dynlayer-attack.html
   ....dynlayer-dragdraw.html
   demo.oncontentchange.html
   demo.onlocationchange.html
   demo.slideshow.html
   demo.spaceship-circle.html
   demo.spaceship-path.html
   ...emplate.imageframe.html
   ...yndocument-addhtml.html
   ...r-anchor-anchoring.html
   ...dynlayer-anchor-ii.html
   ...-anchor-stretching.html
   ...pi.dynlayer-anchor.html
   ....dynlayer-autosize.html
   ...ynlayer-blackboard.html
   ...pi.dynlayer-create.html
   ...i.dynlayer-destroy.html
   ....dynlayer-relative.html
   ...api.dynlayer-slide.html
   ....api.ext.dragevent.html
   ....ext.inline-widget.html
   dynapi.api.ext.inline.html
   ....api.ext.keyevents.html
   ...pi.ext.tabmanager1.html
   ...pi.ext.tabmanager2.html
   dynapi.api.mouseevent.html
   ...ment.capturehotkey.html
   ...unctions.fadecolor.html
   ...functions.getimage.html
   dynapi.functions.html
   ...ctions.imageloader.html
   ...ions.subclassevent.html
   dynapi.fx.bezier.html
   dynapi.fx.circleanim.html
   dynapi.fx.fader.html
   dynapi.fx.flashsound.html
   dynapi.fx.glideanim.html
   dynapi.fx.hover.html
   dynapi.fx.motionx.html
   dynapi.fx.pathanim.html
   dynapi.fx.slideanim.html
   dynapi.fx.snapx.html
   dynapi.fx.swiper.html
   dynapi.fx.textanim.html
   dynapi.fx.timerx.html
   ...rdermanager-boxfix.html
   ...ordermanager-inner.html
   ...ordermanager-outer.html
   ...rdermanager-random.html
   dynapi.gui.button.html
   dynapi.gui.checkbox.html
   dynapi.gui.explorer.html
   ...i.gui.focusmanager.html
   dynapi.gui.graphics.html
   ...i.gui.groupmanager.html
   ...pi.gui.highlighter.html
   dynapi.gui.htmlbutton.html
   ...i.gui.htmlcalendar.html
   ...i.gui.htmlcheckbox.html
   dynapi.gui.htmlclock.html
   ...ui.htmlcolorpicker.html
   ....gui.htmlcontainer.html
   ...gui.htmldatepicker.html
   ...i.htmldropdownmenu.html
   dynapi.gui.htmlfile.html
   ....gui.htmlhyperlink.html
   ...pi.gui.htmllistbox.html
   ...ui.htmlmenu-images.html
   ...htmlmenu-startmenu.html
   dynapi.gui.htmlmenu.html
   ...ui.htmlprogressbar.html
   ...ui.htmlradiobutton.html
   ...i.gui.htmlrollover.html
   ...i.gui.htmltextarea.html
   ...pi.gui.htmltextbox.html
   dynapi.gui.imageclip.html
   dynapi.gui.knob.html
   dynapi.gui.label.html
   dynapi.gui.list.html
   dynapi.gui.listbox.html
   dynapi.gui.loadpanel.html
   dynapi.gui.marquee.html
   ...i.panelbar-stacker.html
   ...pi.gui.progressbar.html
   ...pi.gui.radiobutton.html
   dynapi.gui.scrollbar.html
   ...emplatemanager-htc.html
   ...ui.templatemanager.html
   dynapi.gui.tree.html
   ....viewpane-explorer.html
   ...viewpane-loadpanel.html
   dynapi.gui.viewpane.html
   dynapi.library-file1.js
   dynapi.library-file2.js
   dynapi.library-load.html
   dynapi.util.cookie.html
   ...atasource-acronyms.html
   ...il.datasource-forms.asp
   ...l.datasource-forms.html
   ...l.datasource-paging.asp
   ....datasource-paging.html
   ...atasource-testfile.html
   ...pi.util.datasource.html
   ...pi.util.filereader.html
   dynapi.util.filereader.xml
   ...ement-dynamic-code.html
   ...ement-dynamic-data.html
   ...til.ioelement-post.html
   ...lement-postresponse.asp
   ...lement-postresponse.php
   ...element-postresponse.pl
   ...lement-soda-calc-js.asp
   ...ement-soda-calc-vbs.asp
   ...ioelement-soda-calc.php
   ...oelement-soda-sync.html
   ...ment-soda-tester-vb.asp
   ...lement-soda-tester.html
   ...element-soda-tester.php
   ...til.ioelement-soda.html
   ...ioelement-testfile.html
   ...il.ioelement-upload.asp
   ...l.ioelement-upload.html
   ...il.ioelement-upload.php
   dynapi.util.ioelement.html
   ....util.stringbuffer.html
   ioelmsrv.jscript.asp
   ioelmsrv.php
   ioelmsrv.pl
   ioelmsrv.pm
   ioelmsrv.soda.jscript.asp
   ioelmsrv.soda.php
   ioelmsrv.soda.pl
   ioelmsrv.soda.vbscript.asp
   ioelmsrv.vbscript.asp
   speedtest.button.html
   speedtest.checkbox.html
   ...est.dynlayer-basic.html
   ...dynlayer-deep_nest.html
   ....dynlayer-oncreate.html
   ...yer-setclass-basic.html
   ...-basic-blueprint_def.js
   ...-basic-blueprint_ns4.js
   ...r.inline-basic-dom.html
   ...layer.inline-basic.html
   ...line-deep_nest-dom.html
   ...etcontentwidth.dom.html
   speedtest.knob.html
   speedtest.listbox.html
   speedtest.radiobutton.html
   speedtest.scrollbar.html
   ...reatewidget.button.html
   upload.asp

<html>
<head>
<title>DynAPI Examples - MotionX Class</title>
<script language="JavaScript" src="../src/dynapi.js"></script>
<script language="Javascript">
dynapi.library.setPath('../src/');
dynapi.library.include('dynapi.library');
dynapi.library.include('dynapi.api');
dynapi.library.include('dynapi.api.ext.DynKeyEvent');
dynapi.library.include('dynapi.fx.TimerX');
dynapi.library.include('dynapi.fx.MotionX');
</script>
<script language="Javascript">

var score,hits=0

h = dynapi.functions.getImage('images/f1-dot.gif',14,14);
ball= new DynLayer(h.getHTML(),350,100,14,14)
ball.setID('ball');
score= new DynLayer("Score:0",490,65,70,20)
score.setID('score')

pad=new DynLayer("<font face=arial size=3><b>=====</b></font>",155,242,60,20)
pad.setID('p');

blockT=new DynLayer(null,105,60,465,5,'#c0c0c0');
blockT.setID('t');
blockL=new DynLayer(null,105,60,5,205,'#c0c0c0');
blockL.setID('l');
blockB=new DynLayer(null,105,265,465,10,'#c0c0c0');
blockB.setID('b');
blockR=new DynLayer(null,565,60,5,205,'#c0c0c0');
blockR.setID('r')

blockA=new DynLayer(null,140,90,40,30,'#c0c0c0');
blockA.setID('a');
blockC=new DynLayer(null,125,195,80,20,'#c0c0c0');
blockC.setID('c');
blockD=new DynLayer(null,470,190,40,30,'#c0c0c0');
blockD.setID('d');
blockE=new DynLayer(null,440,90,80,20,'#c0c0c0');
blockE.setID('e');

blockT.makeSolid()
blockL.makeSolid()
blockB.makeSolid()
blockR.makeSolid()

blockA.makeSolid()
blockC.makeSolid()
blockD.makeSolid()
blockE.makeSolid()

pad.makeSolid()

evn={}
evn.oncollide=function(e) {
	var me=e.getSource();
	var blocks="adce"

	if (blocks.indexOf(me.id)>=0) {
		me.setBgColor('#FFCC00')
		setTimeout(me+'.setBgColor("#c0c0c0");',500)
	}else if (me.id=="p") {
		me.setHTML('<font color="red" face=arial size=3><b>=====</b></font>')
		setTimeout(me+'.setHTML("<font face=arial size=3><b>=====</b></font>");',500)
	}else {
		me.setBgColor('#0000FF')
		setTimeout(me+'.setBgColor("#c0c0c0");',500)
		if (me.id=="b") {
			hits--
			score.setHTML("Score:"+hits)
		}
	}
}
blockT.addEventListener(evn)
blockL.addEventListener(evn)
blockB.addEventListener(evn)
blockR.addEventListener(evn)


blockA.addEventListener(evn)
blockC.addEventListener(evn)
blockD.addEventListener(evn)
blockE.addEventListener(evn)

pad.addEventListener(evn)

evn={}
evn.onkeydown=function(e) {
	var me=DynObject.all['p']
	if ((e.which==39||e.charKey=='6') && (me.x+me.w+20)<=575) {
		me.setLocation(me.x+20);return true
	}else if ((e.which==37||e.charKey=='4')){
		if (me.x-20>=125) {
			me.setLocation(me.x-20);
			return true;
		}else{
			me.setLocation(125)
		}
	}

}

dynapi.document.addEventListener(evn);


//------- Add Listener to ball ------------------
evn={}
evn.ontimer=function(e){
	var me=e.getSource();

	var x=me.x
	var y=me.y

	x=x+me.fx
	y=y+me.fy
	if(x>575){x=150;y=80}

	me.setLocation(x,y)
}
evn.oncollide=function(e){
	var me=e.getSource();
	var obs=me.getObstacle()

	xx="EW";yy="NS"
	if (xx.indexOf(me.getImpactSide())>=0) me.fx=me.fx*-1
	if (yy.indexOf(me.getImpactSide())>=0) me.fy=me.fy*-1

	status = me.id +" collides with "+obs.id
	setTimeout("status=''",1500)

	xx="adce"
	if (xx.indexOf(obs.id)>=0) {hits++}
	score.setHTML("Score:"+hits)
}

ball.addEventListener(evn)
ball.makeSolid()
ball.fx=10;ball.fy=10
ball.startTimer(60)

dynapi.document.addChild(blockT)
dynapi.document.addChild(blockL)
dynapi.document.addChild(blockB)
dynapi.document.addChild(blockR)

dynapi.document.addChild(blockA)
dynapi.document.addChild(blockC)
dynapi.document.addChild(blockD)
dynapi.document.addChild(blockE)

dynapi.document.addChild(ball)
dynapi.document.addChild(pad)
dynapi.document.addChild(score)

</script>
</head>

<body bgcolor="#FFFFFF">
<script>
dynapi.document.insertAllChildren();
</script>
<font face="arial" size="2">To play the game above use the left and right arrow keys (or the numbers 4
&amp; 6 when using NS4) to prevent the ball from touching the base line.
<i>Note: The game has some minor flaws, but works great for a demonstration. Enjoy!</i></font>

</body>
</html>

About Koders | Resources | Downloads | Support | Black Duck | Terms of Service | DMCA | Privacy Policy | Contact Us