Benutzerinformationen überspringen
Wohnort: Netherlands
Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer
: https://pame.virtualtuur.com
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
import flash.utils.Timer; import flash.events.TimerEvent; import krpano_as3_interface; var krpano : krpano_as3_interface = null; var pluginpath : String = null; var pluginobj : Object = null; var ShowAnalog:Boolean = false; var ShowDigital:Boolean = true; var ShowDate:Boolean = true; var timer:Timer = new Timer(1000); timer.addEventListener(TimerEvent.TIMER, showClock); if (stage) { stage.scaleMode = StageScaleMode.NO_SCALE;// no automatic scaling stage.align = StageAlign.TOP_LEFT;// align on top left corner timer.start(); } else { this.addEventListener(Event.ADDED_TO_STAGE, startClock); this.addEventListener(Event.REMOVED_FROM_STAGE, stopplugin); } function startClock(event:Event) { krpano = krpano_as3_interface.getInstance(); krpano.addPluginEventListener(this, krpano_as3_interface.PLUGINEVENT_REGISTER, registerEvent); timer.start(); } function registerEvent(evt:DataEvent):void { // register event - "data" is the name of the plugin pluginpath = evt.data; pluginobj = krpano.get(pluginpath); var param:* = null //<plugin name="clock" showanalog="true/false" showdigital="true/false" showdate="true/false" //maybe more options later like font color/size/family param = krpano.get(pluginpath + ".showanalog"); if (param != undefined && param != "") ShowAnalog = String( param ).toLowerCase() != "false"; param = krpano.get(pluginpath + ".showdate"); if (param != undefined && param != "") ShowDate = String( param ).toLowerCase() != "false"; param = krpano.get(pluginpath + ".showdigital"); if (param != undefined && param != "") ShowDigital = String( param ).toLowerCase() != "false"; //register functions so you can trace the date/time krpano.set(pluginpath+".gettime", krgetTime); krpano.set(pluginpath+".getdate", getTime); } function showClock(event:TimerEvent) { /* if(ShowAnalog) { var time:Date = new Date(); var seconds = time.getSeconds(); var minutes = time.getMinutes(); var hours = time.getHours(); //Rotates the pointers on the clock //hourMC.rotation = 30 * hours + minutes / 2; //minuteMC.rotation = 6 * minutes; //secondMC.rotation = 6 * seconds; }*/ if(ShowDigital) { timeTF.text = getTime(); } if(ShowDate) { dateTF.text = getDate(); } } function krgetTime() { krpano.trace(0, "the current time is: " + getTime()); } function krgetDate() { krpano.trace(0, "the current date is: " + getDate()); } function getTime():String { var time:Date = new Date(); var seconds = time.getSeconds(); var minutes = time.getMinutes(); var hours = time.getHours(); if (minutes<10) { minutes = "0"+minutes; } if (seconds<10) { seconds = "0"+seconds; } var currenttime:String = ConvertHour(hours) + ":" + minutes + ":" + seconds; return currenttime } function getDate():String { var time:Date = new Date(); var day:Number = time.getDay(); var month:Number = time.getMonth(); var date:Number = time.getDate(); var year:Number = time.getFullYear(); var currentdate:String = findDay(day) + " " + findMonth(month) + " " + date + " " + year; return currentdate } function findDay(day:Number):String { if (day==0){ return "Sunday" } else if (day==1){ return "Monday" } else if (day==2){ return "Tuesday" } else if (day==3){ return "Wednesday" } else if (day==4){ return "Thursday" } else if (day==5){ return "Friday" } else if (day==6){ return "Saturday" } return "" } function findMonth(month:Number):String { if (month==0){ return "January" } else if (month==1){ return "February" } else if (month==2){ return "March" } else if (month==3){ return "April" } else if (month==4){ return "May" } else if (month==5){ return "June" } else if (month==6){ return "July" } else if (month==7){ return "August" } else if (month==8){ return "September" } else if (month==9){ return "October" } else if (month==10){ return "November" } else if (month==11){ return "December" } return "" } function ConvertHour(hours:Number):String { //converts 24hours to 12hours notation var convertedhours:String; if (hours>12 ) { convertedhours = String(hours-12); } if (hours == 0) { convertedhours = "12"; } return convertedhours } function stopplugin(evt:Event) { krpano.removePluginEventListener(this, krpano_as3_interface.PLUGINEVENT_REGISTER, registerEvent); krpano = null; timer.removeEventListener(TimerEvent.TIMER, showClock); } |
Benutzerinformationen überspringen
Wohnort: Netherlands
Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer
: https://pame.virtualtuur.comBenutzerinformationen überspringen
Wohnort: Netherlands
Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer
: https://pame.virtualtuur.comDieser Beitrag wurde bereits 5 mal editiert, zuletzt von »Tuur« (17. Juni 2010, 01:07)
Benutzerinformationen überspringen
Wohnort: Netherlands
Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer
: https://pame.virtualtuur.comBenutzerinformationen überspringen
Wohnort: Netherlands
Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer
: https://pame.virtualtuur.com|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
import flash.utils.Timer; import flash.events.TimerEvent; import krpano_as3_interface; var krpano : krpano_as3_interface = null; var pluginpath : String = null; var pluginobj : Object = null; var ShowAnalog:Boolean = true; var ShowDigital:Boolean = true; var ShowDate:Boolean = true; var ConvertHours:Boolean = false; var clockMC:Clock = new Clock(); var timer:Timer = new Timer(1000); timer.addEventListener(TimerEvent.TIMER, showClock); if (stage) { stage.scaleMode = StageScaleMode.NO_SCALE;// no automatic scaling stage.align = StageAlign.TOP_LEFT;// align on top left corner timer.start(); } else { //this.addEventListener(Event.ADDED_TO_STAGE, startClock); timer.start(); this.addEventListener(Event.REMOVED_FROM_STAGE, stopplugin); } function startClock(event:Event) { krpano = krpano_as3_interface.getInstance(); krpano.addPluginEventListener(this, krpano_as3_interface.PLUGINEVENT_REGISTER, registerEvent); timer.start(); } function registerEvent(evt:DataEvent):void { // register event - "data" is the name of the plugin pluginpath = evt.data; pluginobj = krpano.get(pluginpath); var param:* = null //<plugin name="clock" showanalog="true/false" showdigital="true/false" showdate="true/false" //maybe more options later like font color/size/family param = krpano.get(pluginpath + ".showanalog"); if (param != undefined && param != "") ShowAnalog = String( param ).toLowerCase() != "false"; param = krpano.get(pluginpath + ".showdate"); if (param != undefined && param != "") ShowDate = String( param ).toLowerCase() != "false"; param = krpano.get(pluginpath + ".showdigital"); if (param != undefined && param != "") ShowDigital = String( param ).toLowerCase() != "false"; param = krpano.get(pluginpath + ".converthours"); if (param != undefined && param != "") ConvertHours = String( param ).toLowerCase() != "false"; //register functions so you can trace the date/time krpano.set(pluginpath+".gettime", krgetTime); krpano.set(pluginpath+".getdate", getTime); } function showClock(event:TimerEvent) { if(ShowAnalog) { var time:Date = new Date(); var seconds = time.getSeconds(); var minutes = time.getMinutes(); var hours = time.getHours(); //Rotates the pointers on the clock if(!clockMC.parent) { this.addChild(clockMC); clockMC.y = timeTF.height + dateTF.height+ 10; } clockMC.hourMC.rotation = 30 * hours + minutes / 2; clockMC.minuteMC.rotation = 6 * minutes; clockMC.secondMC.rotation = 6 * seconds; } if(ShowDigital) { timeTF.text = getTime(); } if(ShowDate) { dateTF.text = getDate(); } } function krgetTime() { krpano.trace(0, "the current time is: " + getTime()); } function krgetDate() { krpano.trace(0, "the current date is: " + getDate()); } function getTime():String { var time:Date = new Date(); var seconds = time.getSeconds(); var minutes = time.getMinutes(); var hours = time.getHours(); if (minutes<10) { minutes = "0"+minutes; } if (seconds<10) { seconds = "0"+seconds; } var currenttime:String = ConvertHour(hours) + ":" + minutes + ":" + seconds; return currenttime } function getDate():String { var time:Date = new Date(); var day:Number = time.getDay(); var month:Number = time.getMonth(); var date:Number = time.getDate(); var year:Number = time.getFullYear(); var currentdate:String = findDay(day) + " " + findMonth(month) + " " + date + " " + year; return currentdate } function findDay(day:Number):String { if (day==0){ return "Sunday" } else if (day==1){ return "Monday" } else if (day==2){ return "Tuesday" } else if (day==3){ return "Wednesday" } else if (day==4){ return "Thursday" } else if (day==5){ return "Friday" } else if (day==6){ return "Saturday" } return "" } function findMonth(month:Number):String { if (month==0){ return "January" } else if (month==1){ return "February" } else if (month==2){ return "March" } else if (month==3){ return "April" } else if (month==4){ return "May" } else if (month==5){ return "June" } else if (month==6){ return "July" } else if (month==7){ return "August" } else if (month==8){ return "September" } else if (month==9){ return "October" } else if (month==10){ return "November" } else if (month==11){ return "December" } return "" } function ConvertHour(hours:Number):Number { //converts 24hours to 12hours notation var convertedhours:Number; if(ConvertHours) { if (hours > 12) { convertedhours = hours-12; } if (hours == 0) { convertedhours = 12; } } else { convertedhours = hours; } return convertedhours } function stopplugin(evt:Event) { krpano.removePluginEventListener(this, krpano_as3_interface.PLUGINEVENT_REGISTER, registerEvent); krpano = null; timer.removeEventListener(TimerEvent.TIMER, showClock); } |
Benutzerinformationen überspringen
Wohnort: Netherlands
Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer
: https://pame.virtualtuur.com
Zitat
<plugin name="infobar_date" keep="true" style="infobar_style" zorder="1100" visible="true"
alpha="1" align="leftbottom" x="215" y="-20" onloaded="delayedcall(2,show_start_infobar(); action(showdate,date));"
/>
<plugin name="infobar_views" keep="false" style="infobar_style" zorder="1100" visible="true"
html="[p align='right'][font size='14']1,234[/font] views[/p]" alpha="1" align="rightbottom" x="165" y="-20" onloaded="delayedcall(2,show_start_infobar());"
/>
<plugin name="date" url="plugins/clock.swf"
align="leftbottom" x="210" y="0" visible="false"
keep="true"
zorder="1101"
showdate="true"
showtime="false"
selectable="false"
alpha="1"
shadow="5"
autosize="center"
/>
<action name="show_start_infobar">
tween(plugin[infobar_date].y,2,0.5);
tween(plugin[infobar_views].y,4,0.5);
</action>
<action name="showdate">
set(plugin[date].getdate,true);
set(plugin[date].visible,true);
tween(plugin[date].alpha,1);
</action>
|
|
Quellcode |
1 2 3 4 5 6 7 8 |
<plugin name="date" url="plugins/clock.swf" align="leftbottom" x="210" y="0" visible="true" keep="true" zorder="100" showdate="true" showdigital="false" selectable="false" /> |
Benutzerinformationen überspringen
Wohnort: Netherlands
Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer
: https://pame.virtualtuur.com