Archive for the ‘Code Samples’ Category
Top 70 ajax demos and code examples
For more attractive web sites;
- Ajallerix : AJAX, simple, fast Web image gallery demo ; at Novell
- AJAX – microlink pattern tutorial : A microlink is a link that opens up content below it.
- Ajax BBC News RSS Reader : demo by Nigel Crawley
- AJAX Chat in Python with Dojo : at AquaAjax
- Ajax Chess : multiplayer chess
Read the rest of this entry »
Flash Actionscript Preloader
Here is a good & working AS2.0 preloader sample.
Insert the code above into frame 1, add new dynamic text on scene and name its var as “showpercent”, that’s all..
onEnterFrame=function(){
var total:Number=_root.getBytesTotal();
var loaded:Number=_root.getBytesLoaded();
if(loaded==total){
delete onEnterFrame
play();
}else{
var percent:Number=Math.floor((loaded/total)*100);
showpercent.text=percent
}
}
stop();
How to disable enter key on html form submit
Here’s a usefull javascript to disable enter key on html form submit. It directs the user to use mouse click.
<script type=”text/javascript”>
function stopRKey(evt) {
var evt = (evt) ? evt : ((event) ? event : null);
var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
if ((evt.keyCode == 13) && (node.type==”text”)) {return false;}
}
document.onkeypress = stopRKey;
</script>
How to disable browser cache for flash
As you know when you upload new swf file to server, browser doesn’t show it until you delete browser cache. Also it’s important to delete swf cache for websites which includes dynamic data and dynamic sub swf files. Here’s the method that we pass this problem for flash.
How to delete xml cache with actionscript?
İt’s important to delete xml cache in flash if your content is renewing it self often. Here’s the sample code for deleting xml cache with actionscript;
Just change your xml loading code with this:



