[Return uniqid function]
return prefix + (new Date()).getTime() + Math.random()*0xFFFFFF;
}
function _startMouse():void { addEventListener(Event.ENTER_FRAME, _ef); }
function _ef(evt:Event):void {
max = -(_container.height - stage.stageHeight);
centerY = int(stage.stageHeight / 2);
dif = centerY - mouseY;
posY = _container.y + dif * 0.4;
_moveC();
}
function _moveC():void {
if (posY <= max) {
posY = max;
} else if (posY >= min) {
posY = min;
}
_container.y = _container.y + (posY - _container.y) / 12;
}
_startMouse();
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.HTTPStatusEvent;
import flash.events.IEventDispatcher;
import flash.events.IOErrorEvent;
import flash.events.SecurityErrorEvent;
import flash.system.ApplicationDomain;
import org.casalib.events.LoadEvent;
import org.casalib.load.DataLoad;
import org.casalib.load.GroupLoad;
import org.casalib.load.SwfLoad;
public class Main extends MovieClip
{
protected var _groupLoad:GroupLoad;
protected var _groupLoadSwfContent:SwfLoad;
protected var _groupLoadSwfFooter:SwfLoad;
protected var _groupLoadSwfHeader:SwfLoad;
protected var _groupLoadSwfMenu:SwfLoad;
protected var _groupLoadSwfSound:SwfLoad;
protected var _groupLoadXmlData:DataLoad;
protected const CONTENT_SWF_PATH:String = ’swf/content.swf’;
protected const FOOTER_SWF_PATH:String = ’swf/footer.swf’;
protected const HEADER_SWF_PATH:String = ’swf/header.swf’;
protected const MENU_SWF_PATH:String = ’swf/menu.swf’;
protected const SOUND_SWF_PATH:String = ’swf/sound.swf’;
protected const DATA_XML_PATH:String = ‘xml/data.xml’;
protected var domainContent:ApplicationDomain;
protected var domainFooter:ApplicationDomain;
protected var domainHeader:ApplicationDomain;
protected var domainMenu:ApplicationDomain;
protected var domainSound:ApplicationDomain;
protected var xmlData:XML = new XML();
public function Main():void
{
_groupLoadSwfContent = new SwfLoad(CONTENT_SWF_PATH);
_groupLoadSwfFooter = new SwfLoad(FOOTER_SWF_PATH);
_groupLoadSwfHeader = new SwfLoad(HEADER_SWF_PATH);
_groupLoadSwfMenu = new SwfLoad(MENU_SWF_PATH);
_groupLoadSwfSound = new SwfLoad(SOUND_SWF_PATH);
_groupLoadXmlData = new DataLoad(DATA_XML_PATH);
_groupLoad = new GroupLoad();
_groupLoad.addLoad(_groupLoadSwfContent);
_groupLoad.addLoad(_groupLoadSwfFooter);
_groupLoad.addLoad(_groupLoadSwfHeader);
_groupLoad.addLoad(_groupLoadSwfMenu);
_groupLoad.addLoad(_groupLoadSwfSound);
_groupLoad.addLoad(_groupLoadXmlData);
addGroupLoadDispatcher(_groupLoad);
_groupLoad.start();
}
protected function addGroupLoadDispatcher(dispatcher:IEventDispatcher):void
{
dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, _groupLoadSecurityError);
dispatcher.addEventListener(IOErrorEvent.IO_ERROR, _groupLoadIoError);
dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, _groupLoadHttpStatus);
dispatcher.addEventListener(LoadEvent.PROGRESS, _groupLoadProgress);
dispatcher.addEventListener(LoadEvent.COMPLETE, _groupLoadComplete);
}
protected function removeGroupLoadDispatcher(dispatcher:IEventDispatcher):void
{
dispatcher.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, _groupLoadSecurityError);
dispatcher.removeEventListener(IOErrorEvent.IO_ERROR, _groupLoadIoError);
dispatcher.removeEventListener(HTTPStatusEvent.HTTP_STATUS, _groupLoadHttpStatus);
dispatcher.removeEventListener(LoadEvent.PROGRESS, _groupLoadProgress);
dispatcher.removeEventListener(LoadEvent.COMPLETE, _groupLoadComplete);
}
protected function _groupLoadSecurityError(evt:Event):void { trace(’securityError: ‘+evt); }
protected function _groupLoadIoError(evt:Event):void { trace(‘ioError: ‘+evt); }
protected function _groupLoadHttpStatus(evt:Event):void { trace(‘httpStatus: ‘+evt); }
protected function _groupLoadProgress(evt:LoadEvent):void { trace(‘%: ‘+evt.progress.percentage); }
protected function _groupLoadComplete(evt:LoadEvent):void
{
domainContent = _groupLoadSwfContent.loader.contentLoaderInfo.applicationDomain;
domainFooter = _groupLoadSwfFooter.loader.contentLoaderInfo.applicationDomain;
domainHeader = _groupLoadSwfHeader.loader.contentLoaderInfo.applicationDomain;
domainMenu = _groupLoadSwfMenu.loader.contentLoaderInfo.applicationDomain;
domainSound = _groupLoadSwfSound.loader.contentLoaderInfo.applicationDomain;
xmlData = XML(_groupLoadXmlData.data);
removeGroupLoadDispatcher(_groupLoad);
}
}
}
var loaderXML:URLLoader = new URLLoader();
loaderXML.addEventListener(Event.COMPLETE, loadXMLCompleteHandler);
loaderXML.load(new URLRequest(“rss.xml”));
function loadXMLCompleteHandler(evt:Event):void
{
rss = new XML(evt.target.data);
rssList = rss.channel.item[0].children();
for(var i:uint=0; i<rssList.length(); i++)
{
if(rssList[i].name() == “description”)
{
contentEncodedString = String(rssList[i+1].children()[0]);
trace(contentEncodedString);
break;
}
}
}
var scrollBarOriginX:Number = scrollBar.x;
var scrollBarOriginY:Number = scrollBar.y;
var scrollContentOriginY:Number = scrollContent.y;
var posY:Number;
var dragRectangle:Rectangle;
var nScrollContentHeight:Number = scrollContent.height;
var nMaskHeight:Number = scrollMask.height;
var nScrollBaseHeight:Number = scrollBase.height;
var nScrollBarHeight:Number;
if (nScrollContentHeight > nMaskHeight){
scrollBar.visible = true;
nScrollBarHeight = Math.floor(nScrollBaseHeight * nMaskHeight / nScrollContentHeight);
scrollBar.height = nScrollBarHeight;
scrollBar.buttonMode = true;
scrollBar.addEventListener(MouseEvent.MOUSE_DOWN, scrollBarMouseDownHandler);
scrollBase.addEventListener(MouseEvent.MOUSE_DOWN, scrollBaseMouseDownHandler);
stage.addEventListener(Event.ENTER_FRAME, stageEnterFrameHandler);
}else{
scrollBar.visible = false;
}
function scrollBarMouseDownHandler(evt:MouseEvent):void{
dragRectangle = new Rectangle(scrollBarOriginX, scrollBarOriginY, 0, nScrollBaseHeight - nScrollBarHeight);
evt.currentTarget.startDrag(false, dragRectangle);
stage.addEventListener(MouseEvent.MOUSE_UP, stageMouseUpHandler);
}
function stageMouseUpHandler(evt:Event):void {
scrollBar.stopDrag();
stage.removeEventListener(MouseEvent.MOUSE_UP, stageMouseUpHandler);
}
function scrollBaseMouseDownHandler(evt:MouseEvent):void{
if(scrollBar.y >= mouseY){
if(scrollContent.y < scrollContentOriginY){
if (nMaskHeight >= -scrollContent.y){
posY = scrollContentOriginY;
}else{
posY = scrollContent.y + nMaskHeight;
}
}
}
else if (nScrollContentHeight - nMaskHeight + (scrollContent.y - scrollContentOriginY) - nMaskHeight <= 0){
posY = scrollContentOriginY - nScrollContentHeight + nMaskHeight;
}else{
posY = scrollContent.y - nMaskHeight;
}
scrollBar.y = Math.round((scrollContentOriginY - posY) / (nScrollContentHeight - nMaskHeight) * (nScrollBaseHeight - nScrollBarHeight) + scrollBarOriginY);
}
function stageEnterFrameHandler(evt:Event):void{
posY = Math.round(scrollContentOriginY-(nScrollContentHeight - nMaskHeight) * (scrollBar.y - scrollBarOriginY) / (nScrollBaseHeight - nScrollBarHeight) );
scrollContent.y += (posY - scrollContent.y) * .4;
}
/**
Correct @ and . Symbol not showing in french and english input textfields
when WMODE is set has transparent/opaque on FireFox web browser
Windows OS only..
@author Adrien Dufond
@version 09/17/08
*/
import flash.text.TextField;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.system.Capabilities;
public class FirefoxWmodeFix
{
private static var usedKey:Array = new Array();
private static var usedShiftKey:Boolean;
private static var sLang:String;
private static var sCurrentText:String;
public static function firefoxWmodeFix(_field:TextField):void
{
sLang = Capabilities.language.substr(0,2);
_field.addEventListener(Event.CHANGE, onFieldChangeHandler);
_field.addEventListener(KeyboardEvent.KEY_DOWN, onFieldKeyDownHandler);
}
private static function onFieldChangeHandler(evt:Event):void
{
sCurrentText = evt.target.text;
if(sLang == ‘fr’)
{
if ((usedKey[usedKey.length-1] == “48″) && (usedKey[usedKey.length-2] == “18″) && (usedKey[usedKey.length-3] == “17″))
{
evt.target.text = sCurrentText.substr(0, sCurrentText.length-1)+“@”;
}
if (usedShiftKey && (usedKey[usedKey.length-1] == “190″) )
{
evt.target.text = sCurrentText.substr(0, sCurrentText.length-1)+“.”;
}
}
else
{
//-> http://bugs.adobe.com/jira/browse/FP-105
if(evt.target.text.slice(evt.target.text.length-1, evt.target.text.length) == “\”“)
{
evt.target.text = evt.target.text.slice(0, evt.target.text.length-1)+“@”;
}
}
}
private static function onFieldKeyDownHandler(evt:KeyboardEvent):void
{
usedKey.push(evt.keyCode);
usedShiftKey = evt.shiftKey;
}
}
}
function delay(event:TimerEvent):void{
var tmp:String = textline.substr(0, 1);
textline = textline.substr(1, textline.length - 1) + tmp;
view_txt.text = textline;
}
package fr.manmaru
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.events.TimerEvent;
import flash.events.Event;
import flash.filters.DropShadowFilter;
import flash.geom.Rectangle;
import flash.ui.Mouse;
import flash.utils.getTimer;
import flash.utils.Timer;
public class GmtTimer extends MovieClip
{
private var worldCity:Array = new Array(
‘addis ababa’,‘aden’,‘algiers’,‘almaty’,‘amman’,‘amsterdam’,‘anadyr’,‘anchorage’,‘ankara’,
‘antananarivo’,‘asuncion’,‘athens’,‘atlanta’,‘auckland’,
‘baghdad’,‘bangkok’,‘barcelona’,‘beijing’,‘beirut’,‘belgrade’,‘berlin’,‘bogota’,‘boston’,‘brasilia’,
‘brisbane’,‘brussels’,‘bucharest’,‘budapest’,‘buenos aires’,
‘cairo’,‘canberra’,‘cape town’,‘Casablanca’,‘chicago’,‘copenhagen’,
‘denver’,‘detroit’,‘dhaka’,‘dubai’,‘dublin’,
‘edmonton’,
‘frankfurt’,
‘geneva’,‘guatemala’,
‘halifax’,‘hanoi’,‘harare’,‘havana’,‘helsinki’,‘hong kong’,‘honolulu’,‘houston’,
‘indianapolis’,‘islamabad’,‘istanbul’,
‘jakarta’,‘jerusalem’,‘johannesburg’,
‘kamchatka’,‘karachi’,‘khartoum’,‘kingston’,‘kiritimati’,‘kuala lumpur’,‘kuwait city’,‘kyiv’,
‘la paz’,‘lagos’,‘lahore’,‘lima’,‘lisbon’,‘london’,‘los Angeles’,
‘madrid’,‘managua’,‘manila’,‘melbourne’,‘mexico City’,‘miami’,
‘minneapolis’,‘minsk’,‘montevideo’,‘montgomery’,‘montreal’,‘moscow’,
‘nairobi’,‘nassau’,‘new orleans’,‘new york’,
‘oslo’,‘ottawa’,
‘paris’,‘perth’,‘philadelphia’,‘phoenix’,‘prague’,
‘reykjavik’,‘rio de janeiro’,‘riyadh’,‘rome’,
’san francisco’,’san juan’,’san salvador’,’santiago’,’santo domingo’,’sao paulo’,
’seattle’,’seoul’,’shanghai’,’singapore’,’sofia’,’st. paul’,’stockholm’,’suva’,’sydney’,
‘taipei’,‘tallinn’,‘tashkent’,‘tegucigalpa’,‘tokyo’,‘toronto’,
‘vancouver’,‘vienna’,‘vladivostok’,
‘warsaw’,‘washington DC’,‘winnipeg’,
‘zagreb’,‘zurich’
);
private var localTime:Array = new Array(
+3,+3,+1,+6,+3,+2,+13,-8,+3,+3,-4,+3,-4,+12,
+3,+7,+2,+8,+3,+2,+2,-5,-4,-3,+10,+2,+3,+2,-3,
+3,+10,+2,+1,+5,+2,
-6,-4,+6,+4,+1,
+6,
+2,
+2,-6,
-3,+7,+2,-4,+3,+8,-10,-5,
-4,+6,+3,
+7,+3,+2,
+13,+6,+3,-5,+14,+8,+3,+3,
-4,+1,+6,+5,+1,+1,-7,
+2,-6,+8,+10,-5,-4,-5,+3,-3,-5,-4,+4,
+3,-4,-5,-4,
+2,-4,
+2,+8,-4,-7,+2,
0,-3,+3,+2,
-7,-4,-6,-4,-4,-3,-7,+9,+8,+8,+3,-5,+2,+12,+10,
+8,+3,+5,-6,+9,-4,
-7,-2,+11,
+2,-4,-5,
+2,+2
);
private var _clockPanel:MovieClip = new MovieClip();
private const friction:uint = 5;
private var arrayClock:Array = new Array();
private var itemXPos:uint = new uint();
private var itemYPos:uint = new uint();
private var count:uint = new uint();
private var multi:uint = new uint();
private var numberPair:Boolean = new Boolean();
private var timer:Timer;
private var GMTdate:Date;
private var cursor:HandPc;
public function GmtTimer():void
{
_clockPanel.x = 31;
_clockPanel.y = 41;
_clockPanel.addEventListener(MouseEvent.MOUSE_DOWN, clockPanelMouseDownHandler);
addChild(_clockPanel);
cursor = new HandPc();
cursor.gotoAndStop(1);
cursor.filters = [new DropShadowFilter(3,60,0,.5,2,1,1)];
cursor.visible = false;
addChild(cursor);
for (var i:Number = 0; i<2; i++)
{
for (var j:Number = 0; j<Math.floor(worldCity.length/2); j++)
{
arrayClock[count] = [‘_clock’+count];
arrayClock[count] = new Clock();
itemXPos = arrayClock[count].width * j;
itemYPos = arrayClock[count].height * i;
arrayClock[count].x = itemXPos;
arrayClock[count].y = itemYPos;
arrayClock[count].id = count;
arrayClock[count].city_txt.text = worldCity[count];
_clockPanel.addChild(arrayClock[count]);
count++;
}
}
stage.addEventListener(MouseEvent.MOUSE_MOVE, stageMouseMoveHandler);
stage.addEventListener(MouseEvent.MOUSE_DOWN, stageMouseDownHandler);
stage.addEventListener(MouseEvent.MOUSE_UP, stageMouseUpHandler);
stage.addEventListener(Event.MOUSE_LEAVE, stageMouseLeaveHandler);
timer = new Timer(1);
timer.addEventListener(TimerEvent.TIMER, onDelay);
timer.start();
}
private function onDelay(event:TimerEvent)
{
GMTdate = new Date();
for(var i:uint; i<worldCity.length-1; i++)
{
if(localTime[i] > -1)
{
arrayClock[i].h = GMTdate.getUTCHours()+localTime[i];
if(arrayClock[i].h > 24) arrayClock[i].h = arrayClock[i].h -24;
}
else
{
arrayClock[i].h = (GMTdate.getUTCHours() + localTime[i]);
}
arrayClock[i].h = arrayClock[i].h + (arrayClock[i].m/60);
arrayClock[i].m = GMTdate.getUTCMinutes();
arrayClock[i].s = GMTdate.getUTCSeconds();
arrayClock[i].percentHour = arrayClock[i].h * 30
arrayClock[i].percentMinute = arrayClock[i].m * 6;
arrayClock[i].percentSecond = arrayClock[i].s * 6;
arrayClock[i].h_mc.rotation = arrayClock[i].percentHour;
arrayClock[i].m_mc.rotation = arrayClock[i].percentMinute;
arrayClock[i].s_mc.rotation = arrayClock[i].percentSecond;
}
_clockPanel.xVel = Math.abs(_clockPanel.x - _clockPanel.lastX);
_clockPanel.x >= _clockPanel.lastX ? _clockPanel.xDir = ‘plus’ : _clockPanel.xDir = ‘minus’;
_clockPanel.lastX = _clockPanel.x;
if(_clockPanel.dropped == true)
{
if (Math.abs(_clockPanel.x-_clockPanel.xDest)>0.1)
{
_clockPanel.x += (_clockPanel.xDest-_clockPanel.x)/20;
}
else
{
_clockPanel.dropped = false;
}
}
}
protected function clockPanelMouseDownHandler(event:MouseEvent):void
{
stage.addEventListener(MouseEvent.MOUSE_MOVE, startDragClockPanel);
stage.addEventListener(MouseEvent.MOUSE_UP, stopDragClockPanel);
}
protected function startDragClockPanel(event:MouseEvent):void
{
_clockPanel.startDrag(false,new Rectangle(31, 41, -(_clockPanel.width) + 508, 0));
}
protected function stopDragClockPanel(event:MouseEvent):void
{
_clockPanel.stopDrag();
_clockPanel.dropped = true;
_clockPanel.xDir == ‘plus’ ? _clockPanel.xDest = _clockPanel.x+(_clockPanel.xVel*friction) : _clockPanel.xDest = _clockPanel.x-(_clockPanel.xVel*friction);
stage.removeEventListener(MouseEvent.MOUSE_MOVE, startDragClockPanel);
stage.removeEventListener(MouseEvent.MOUSE_UP, stopDragClockPanel);
}
protected function stageMouseMoveHandler(event:MouseEvent):void
{
cursor.x = stage.mouseX;
cursor.y = stage.mouseY;
if(cursor.hitTestObject(_clockPanel))
{
cursor.visible = true;
Mouse.hide();
}
else
{
cursor.visible = false;
Mouse.show();
}
}
protected function stageMouseDownHandler(event:MouseEvent):void{ cursor.gotoAndStop(2); }
protected function stageMouseUpHandler(event:MouseEvent):void{ cursor.gotoAndStop(1); }
protected function stageMouseLeaveHandler(event:Event):void
{
cursor.gotoAndStop(1);
cursor.visible = false;
Mouse.show();
}
}
}