Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash








Timezone Offset For Bangalore?


Hi there,

I have a prety big issue.

I have a world clock component that displays all the timezones based off a FLA I got from flashkit. The problem is that I can not set th component to +05.5 which is the actual time for Bangalore, India. I can either do +06 or +05. Unfortunately, my boss wants the exact time so we can't get away with using just +05.

Please help,

Thank you,
Ynygma




FlashKit > Flash Help > Flash MX
Posted on: 01-07-2003, 11:45 AM


View Complete Forum Thread with Replies

Sponsored Links:

Countdown Timer, Timezone Offset Stuck In Eastern Time
I have a countdown timer that will be used for events that happen locally central time, mountain time, etc. However, if someone on eastern or pacific time (or any variation of the 4 timezones) looks at the countdown timer, I want to make sure that it shows the time relative to their timezone.

I thought i could read the user's timezone offset (Date.getTimezoneOffset) and subtract from it the hardcoded timezone offset of the event (passed as a variable from XML depending on the event's "primary" timezone).

Am I getting the math here wrong? The "net" timezone offset from the user - the event timezone offsets SHOULD add into the countdown time.

However, Date.getTimezoneOffset, regardless of my Mac or PC timezone setting/time, keeps showing an Eastern timezone offset of 5 hours. What's going on?

The time is correct when I hardcode an event timezone offset to anything other than Eastern time. I think the problem is that it's not getting a user timezone offset OTHER than -5 hours for Eastern Time.

Code for the timer is here (assume that the target event timezone has been passed in):


Code:
this.onEnterFrame = function() {
var today:Date = new Date();
var currentYear = today.getFullYear();
var currentTime = today.getTime();
var currentOffset = today.getTimezoneOffset() * 60 * 1000;

var targetDate:Date = new Date(countTimeYear,countTimeMonth,countTimeDate,countTimeHour,countTimeMinute);
var targetTime = targetDate.getTime();
var targetOffset:Number;
switch(countTimeZone) {
case "eastern" :
targetOffset = 5;
break;

case "central" :
targetOffset = 6;
break;

case "mountain" :
targetOffset = 7;
break;

case "pacific" :
targetOffset = 8;
break;

default :
targetOffset = 5;
break;
}
targetOffset = targetOffset * 60 * 60 * 1000;
var totalOffset = targetOffset - currentOffset;
var timeLeft = targetTime - currentTime + totalOffset;

var millisec = Math.floor(timeLeft);
var seconds = Math.floor(timeLeft/1000);
var minutes = Math.floor(seconds/60);
var hours = Math.floor(minutes/60);
var days = Math.floor(hours/24);

millisec = String(millisec % 10);

seconds = String(seconds % 60);
if (seconds.length < 2) {
seconds = "0" + seconds;
}

minutes = String(minutes % 60);
if (minutes.length < 2) {
minutes = "0" + minutes;
}

hours = String(hours % 24);
if (hours.length < 2) {
hours = "0" + hours;
}

days = String(days);
if (days.length == 1) {
days = "000" + days;
} else if (days.length == 2) {
days = "00" + days;
} else if (days.length == 3) {
days = "0" + days;
}

if (timeLeft > 0) {
countdownTime = days + ":" + hours + ":" + minutes + ":" + seconds + "." + millisec;
} else {
countdownTime = "0000:00:00:00.0";
}

this.countdown_text.text = countdownTime;
}
Thoughts? Suggestions?

IronChefMorimoto

View Replies !    View Related
Countdown Timer, Timezone Offset Stuck In Eastern Time
I have a countdown timer that will be used for events that happen locally central time, mountain time, etc. However, if someone on eastern or pacific time (or any variation of the 4 timezones) looks at the countdown timer, I want to make sure that it shows the time relative to their timezone.

I thought i could read the user's timezone offset (Date.getTimezoneOffset) and subtract from it the hardcoded timezone offset of the event (passed as a variable from XML depending on the event's "primary" timezone).

Am I getting the math here wrong? The "net" timezone offset from the user - the event timezone offsets SHOULD add into the countdown time.

However, Date.getTimezoneOffset, regardless of my Mac or PC timezone setting/time, keeps showing an Eastern timezone offset of 5 hours. What's going on?

The time is correct when I hardcode an event timezone offset to anything other than Eastern time. I think the problem is that it's not getting a user timezone offset OTHER than -5 hours for Eastern Time.

Code for the timer is here (assume that the target event timezone has been passed in):


Code:
this.onEnterFrame = function() {
var today:Date = new Date();
var currentYear = today.getFullYear();
var currentTime = today.getTime();
var currentOffset = today.getTimezoneOffset() * 60 * 1000;

var targetDate:Date = new Date(countTimeYear,countTimeMonth,countTimeDate,countTimeHour,countTimeMinute);
var targetTime = targetDate.getTime();
var targetOffset:Number;
switch(countTimeZone) {
case "eastern" :
targetOffset = 5;
break;

case "central" :
targetOffset = 6;
break;

case "mountain" :
targetOffset = 7;
break;

case "pacific" :
targetOffset = 8;
break;

default :
targetOffset = 5;
break;
}
targetOffset = targetOffset * 60 * 60 * 1000;
var totalOffset = targetOffset - currentOffset;
var timeLeft = targetTime - currentTime + totalOffset;

var millisec = Math.floor(timeLeft);
var seconds = Math.floor(timeLeft/1000);
var minutes = Math.floor(seconds/60);
var hours = Math.floor(minutes/60);
var days = Math.floor(hours/24);

millisec = String(millisec % 10);

seconds = String(seconds % 60);
if (seconds.length < 2) {
seconds = "0" + seconds;
}

minutes = String(minutes % 60);
if (minutes.length < 2) {
minutes = "0" + minutes;
}

hours = String(hours % 24);
if (hours.length < 2) {
hours = "0" + hours;
}

days = String(days);
if (days.length == 1) {
days = "000" + days;
} else if (days.length == 2) {
days = "00" + days;
} else if (days.length == 3) {
days = "0" + days;
}

if (timeLeft > 0) {
countdownTime = days + ":" + hours + ":" + minutes + ":" + seconds + "." + millisec;
} else {
countdownTime = "0000:00:00:00.0";
}

this.countdown_text.text = countdownTime;
}
Thoughts? Suggestions?

IronChefMorimoto

View Replies !    View Related
Timezone
Ok a little background info:

I have a countdown script that reads the server time from a mktime php file (xml type)
It works great UNTIL i change the timezone.

Is it possible to static set the timezone, so it doesnt mather from what timezone the user comes from, it will use the servers timezone??? :)'

Thanx in advance!

CODE:









Attach Code

var d0;
var d1;
var d2;
var h0;
var h1;
var m0;
var m1;
var s0;
var s1;

var yr;
var mo;
var da;
var ho;
var mi;

var nextYear:Boolean;
var timeScript:String;

var now_date:Date;

var load_xml:XML;

var isSound:Boolean;

// sound
var tick_sound = new Sound();
tick_sound.attachSound("tick");
tick_sound.setVolume(25);

startCountdown = function ( yr:Number,mo:Number,da:Number,ho:Number,mi:Number,nextYear:Boolean,timeScript:String,color, snd ):Void
{

// do colours
d0_txt.textColor = Number("0x"+color);
d1_txt.textColor = Number("0x"+color);
d2_txt.textColor = Number("0x"+color);
h0_txt.textColor = Number("0x"+color);
h1_txt.textColor = Number("0x"+color);
m0_txt.textColor = Number("0x"+color);
m1_txt.textColor = Number("0x"+color);
s0_txt.textColor = Number("0x"+color);
s1_txt.textColor = Number("0x"+color);

this.yr = yr;
this.mo = mo;
this.da = da;
this.ho = ho;
this.mi = mi;

this.nextYear = nextYear;
this.timeScript = timeScript;

this.isSound = (snd.length) ? true : false;

getCurrentTime();
}



getCurrentTime = function ()
{

if (this.timeScript == "")
{
this.now_date = new Date( ms );
checkMSecsRemaining();
}
else
{
trace("loadXML");
// load mktime from php script
// using XML
//
// <data><ms>12345678</ms></data>
//
load_xml = new XML();
load_xml.ignoreWhite = true;
load_xml.onLoad = function (success)
{
// parse me

if (success)

{
//trace(this.toString());
var ms = Number(this.firstChild.firstChild.firstChild.nodeValue) * 1000 ;
now_date = new Date( ms ) ;


checkMSecsRemaining();

}
}

load_xml.load( this.timeScript );
}

}





checkMSecsRemaining = function ()
{
startMSecsRemaining = getMSecsRemaining(yr,mo,da,ho,mi); // seconds to xmas at the start of the film

if (startMSecsRemaining)
setControlMC();
else
setDisplay();
}




setControlMC = function ()
{
this.createEmptyMovieClip( "control_mc", 0 );
control_mc.onEnterFrame = function ()
{
this._parent.setDisplay();
}
}



getMSecsRemaining = function (year:Number, mon:Number, day:Number, hour:Number, min:Number)
{

// get the number of milliseconds to enddate based on system time

if (!year) year = now_date.getFullYear();
var end_date = new Date( year, mon-1, day, hour, min );

// if today's date is larger than chosen date, increase to next year

if ( end_date.getTime() < now_date.getTime() && !this.nextYear )
{
// target date is in the past, set countdown to 0
return 0;
}
else
{
while ( end_date.getTime() < now_date.getTime() )
end_date.setYear( Number(end_date.getFullYear()) + 1 );

return Math.floor( end_date.getTime() - now_date.getTime() );
}

}

getMSecsElapsed = function ()
{
return Math.floor( getTimer() );
}


setChar = function (part:String, val:String)
{
if (this[part] != val)
{
this[part+"_txt"].text = this[part] = val;
if (part == "s1" && tick_sound.getVolume() && isSound)
{ // tick each second
tick_sound.start();
tick_sound.setVolume( tick_sound.getVolume()-1 );
}
}
}

leadingZeros = function (str:String, no:Number)
{
while (str.length < no)
str = "0"+str;
return str;
}


setDisplay = function ()
{

var msecs = startMSecsRemaining - getMSecsElapsed(); // updated msecs to xmas;

if (msecs > 0) {

temp_date = new Date (msecs);


var d = Math.floor( msecs/86400000 );
var h = Math.floor( (msecs - (d*86400000)) / 3600000 );
var m = temp_date.getMinutes().toString();
var s = temp_date.getSeconds().toString();

d = leadingZeros(d.toString(),3);
h = leadingZeros(h.toString(),2);
m = leadingZeros(m,2);
s = leadingZeros(s,2);


setChar( "d0", d.charAt(0) );
setChar( "d1", d.charAt(1) );
setChar( "d2", d.charAt(2) );

setChar( "h0", h.charAt(0) );
setChar( "h1", h.charAt(1) );

setChar( "m0", m.charAt(0) );
setChar( "m1", m.charAt(1) );

setChar( "s0", s.charAt(0) );
setChar( "s1", s.charAt(1) );



}
else
{


d0_txt.text = "0";
d1_txt.text = "0";
d2_txt.text = "0";
h0_txt.text = "0";
h1_txt.text = "0";
m0_txt.text = "0";
m1_txt.text = "0";
s0_txt.text = "0";
s1_txt.text = "0";


}

}

View Replies !    View Related
Timezone
Hi All

I am creating a Countdown timer and I want to cater to all locations, but I cannot retrieve
GMT-1000 from the date Object. Why is this? How do I know what target time to display?

The time I want to target is CET 20.45.

I used the '.getTimezoneOffset();' method but this returns various timezones for
some countries and the exact number for others.

Can I can use the setDate() to set my local time and then cross reference it with the local Timezone or
is there another solution to my problem?

Any help will be much appreciated

regards

javono
www.javono.com

View Replies !    View Related
Timezone
Ok, I have put all the elements together for my TimeZone swf.
I have a background with hours from 0 through to 23. See this image http://www.actionscript.org/forums/a...0&d=1146732812

I then have an Mc called cities_mc which will move from left to right depending on the time of day. This cities_mc is duplicated and moved to the back of cities_mc so that it has a continuously flowing look. What confuses me about this is the startup position. I have moved the content within cities_mc to line up LONDON with the 0 position, since this is Greenwich mean time. Then when someone logs on, the date object will calculate where on the grid London should be moved to and that the TimeZone, then starts from there.

Here is my code so far:


ActionScript Code:
var myDate = new Date();//create new date object
var myTime = myDate.getTime (); //get the current time in milliseconds
var curTimeOfDay = (myDate.getHours() * 24 * 3600) + (myDate.getMinutes() * 60);//
var curTimeOfDayFraction = curTimeOfDay / 86400;
var mcStartPos = 0;
var mcPos = mcStartPos + (curTimeOfDayFraction * mc._width);
 
cities_mc.duplicateMovieClip("citiesLeft_mc", 10);
citiesLeft_mc._x = -cities_mc._width + cities_mc._x;
 
cities_mc.onEnterFrame = function () {
    cities_mc._x +=1;
   
}

View Replies !    View Related
Help With TimeZone Difference
Hello,

I found a tutorial on the site with the following actionscript:


Code:
today = new Date();

today.getHours() = getUTCHours + 4

if (today.getMinutes()<10)
{
if (today.getSeconds()<10)
{
time = today.getHours() add ":0" add today.getMinutes()
add ":0" add today.getSeconds();
}
if (today.getSeconds()>=10)
{
time = today.getHours() add ":0" add today.getMinutes()
add ":" add today.getSeconds();
}
}

if (today.getMinutes()>=10)
{
if (today.getSeconds()<10)
{
time = today.getHours() add ":" add today.getMinutes()
add ":0" add today.getSeconds();
}
if (today.getSeconds()>=10)
{
time = today.getHours() add ":" add today.getMinutes()
add ":" add today.getSeconds();
}
}


This all works fine except for I want to display the time for a certain timezone no matter who sees it rather than by the visitors local time.

Could someone help me out with that?

Thanks,
Justin.

View Replies !    View Related
Creating A Timezone
Can anyone tell me if they have found something like this gif I have uploaded in Flash Format?

View Replies !    View Related
Displaying Timezone
Hi
Can anyone tell how to get the timezone of the PC?
i.e. a user input(timezone) should be converted to the local time zone & displayed.

Im using flex builder2.


thanx in advance


Sheetal

View Replies !    View Related
Help: Timezone Script
Can anyone help me with this action script. The problem is the time for Mumbai (www.mfgtrading.com) when ever it hits 3am in singapore time the mumbai time reads as 001:00. It should be 00:00

Please help me.. here is the code

Root Code 1st frame

HTML Code:
attachMovie("DateAndTime", "myClip", 10);
myClip._x = 0;
MyClip._y = 0;
MyClip._visible = false;
Movie 1st frame code

HTML Code:
mypDate = new Date();
Movie 2nd frame code

HTML Code:
function amendHours(Hours)
{
var _l1 = Hours;
if (_l1 == 24)
{
_l1 = "0";
}
// end if
if (_l1 == 25)
{
_l1 = "1";
}
// end if
if (_l1 == 26)
{
_l1 = "2";
}
// end if
if (_l1 == 27)
{
_l1 = "3";
}
// end if
if (_l1 == 28)
{
_l1 = "4";
}
// end if
if (_l1 == 29)
{
_l1 = "5";
}
// end if
if (_l1 == 30)
{
_l1 = "6";
}
// end if
if (_l1 == 31)
{
_l1 = "7";
}
// end if
if (_l1 == 32)
{
_l1 = "8";
}
// end if
if (_l1 == 33)
{
_l1 = "9";
}
// end if
if (_l1 == 34)
{
_l1 = "10";
}
// end if
if (_l1 == 35)
{
_l1 = "11";
}
// end if
if (_l1 == 36)
{
_l1 = "12";
}
// end if
if (_l1 == 37)
{
_l1 = "13";
}
// end if
if (_l1 == 38)
{
_l1 = "14";
}
// end if
if (_l1 == 39)
{
_l1 = "15";
}
// end if
if (_l1 == 40)
{
_l1 = "16";
}
// end if
if (_l1 == 41)
{
_l1 = "17";
}
// end if
if (_l1 == 42)
{
_l1 = "18";
}
// end if
if (_l1 == 43)
{
_l1 = "19";
}
// end if
if (_l1 == 44)
{
_l1 = "20";
}
// end if
if (_l1 == 45)
{
_l1 = "21";
}
// end if
if (_l1 == 46)
{
_l1 = "22";
}
// end if
if (_l1 == 47)
{
_l1 = "23";
}
// end if
if (_l1 == 48)
{
_l1 = "24";
}
// end if
if (_l1 == -1)
{
_l1 = "23";
}
// end if
if (_l1 == -2)
{
_l1 = "22";
}
// end if
if (_l1 == -3)
{
_l1 = "21";
}
// end if
if (_l1 == -4)
{
_l1 = "20";
}
// end if
if (_l1 == -5)
{
_l1 = "19";
}
// end if
if (_l1 == -6)
{
_l1 = "18";
}
// end if
if (_l1 == -7)
{
_l1 = "17";
}
// end if
if (_l1 == -8)
{
_l1 = "16";
}
// end if
if (_l1 == -9)
{
_l1 = "15";
}
// end if
if (_l1 == -10)
{
_l1 = "14";this
}
// end if
return(_l1);
}
// End of the function
si_seconds = mypdate.getUTCSeconds() < 10 ? ("0" + mypdate.getUTCSeconds()) : (mypdate.getUTCSeconds());
si_minutes = mypdate.getUTCMinutes() < 10 ? ("0" + mypdate.getUTCMinutes()) : (mypdate.getUTCMinutes());
si_hours = mypdate.getUTCHours();
si_month = mypdate.getUTCMonth();
si_year = mypdate.getUTCFullYear();
si_date = mypdate.getUTCDate();
var hongkongHours = amendHours(si_hours + 8);
var singaporeHours = amendHours(si_hours + 8);
var mumbaiHours = amendHours(si_hours + 5);
var dubaiHours = amendHours(si_hours + 4);
if (si_minutes < 30)
{
mumbaiHours2 = mumbaiHours;
}
else
{
mumbaiHours2 = mumbaiHours + 1;
} // end if
if (si_minutes == 0)
{
mumbaiMinutes = "30";
}
else if (si_minutes == 1)
{
mumbaiMinutes = "31";
}
else if (si_minutes == 2)
{
mumbaiMinutes = "32";
}
else if (si_minutes == 3)
{
mumbaiMinutes = "33";
}
else if (si_minutes == 4)
{
mumbaiMinutes = "34";
}
else if (si_minutes == 5)
{
mumbaiMinutes = "35";
}
else if (si_minutes == 6)
{
mumbaiMinutes = "36";
}
else if (si_minutes == 7)
{
mumbaiMinutes = "37";
}
else if (si_minutes == 8)
{
mumbaiMinutes = "38";
}
else if (si_minutes == 9)
{
mumbaiMinutes = "39";
}
else if (si_minutes == 10)
{
mumbaiMinutes = "40";
}
else if (si_minutes == 11)
{
mumbaiMinutes = "41";
}
else if (si_minutes == 12)
{
mumbaiMinutes = "42";
}
else if (si_minutes == 13)
{
mumbaiMinutes = "43";
}
else if (si_minutes == 14)
{
mumbaiMinutes = "44";
}
else if (si_minutes == 15)
{
mumbaiMinutes = "45";
}
else if (si_minutes == 16)
{
mumbaiMinutes = "46";
}
else if (si_minutes == 17)
{
mumbaiMinutes = "47";
}
else if (si_minutes == 18)
{
mumbaiMinutes = "48";
}
else if (si_minutes == 19)
{
mumbaiMinutes = "49";
}
else if (si_minutes == 20)
{
mumbaiMinutes = "50";
}
else if (si_minutes == 21)
{
mumbaiMinutes = "51";
}
else if (si_minutes == 22)
{
mumbaiMinutes = "52";
}
else if (si_minutes == 23)
{
mumbaiMinutes = "53";
}
else if (si_minutes == 24)
{
mumbaiMinutes = "54";
}
else if (si_minutes == 25)
{
mumbaiMinutes = "55";
}
else if (si_minutes == 26)
{
mumbaiMinutes = "56";
}
else if (si_minutes == 27)
{
mumbaiMinutes = "57";
}
else if (si_minutes == 28)
{
mumbaiMinutes = "58";
}
else if (si_minutes == 29)
{
mumbaiMinutes = "59";
}
else if (si_minutes == 30)
{
mumbaiMinutes = "00";
}
else if (si_minutes == 31)
{
mumbaiMinutes = "01";
}
else if (si_minutes == 32)
{
mumbaiMinutes = "02";
}
else if (si_minutes == 33)
{
mumbaiMinutes = "03";
}
else if (si_minutes == 34)
{
mumbaiMinutes = "04";
}
else if (si_minutes == 35)
{
mumbaiMinutes = "05";
}
else if (si_minutes == 36)
{
mumbaiMinutes = "06";
}
else if (si_minutes == 37)
{
mumbaiMinutes = "07";
}
else if (si_minutes == 38)
{
mumbaiMinutes = "08";
}
else if (si_minutes == 39)
{
mumbaiMinutes = "09";
}
else if (si_minutes == 40)
{
mumbaiMinutes = "10";
}
else if (si_minutes == 41)
{
mumbaiMinutes = "11";
}
else if (si_minutes == 42)
{
mumbaiMinutes = "12";
}
else
{
mumbaiMinutes = si_minutes - 30;
} // end if
var londonHours = amendHours(si_hours + 0);
var sydneyHours = amendHours(si_hours + 11);
var chicagoHours = amendHours(si_hours + 18);
var newyorkHours = amendHours(si_hours + 19);
var londonSummer = 0;
if (si_month == 3)
{
londonSummer = 1;
} // end if
if (si_month == 4)
{
londonSummer = 1;
} // end if
if (si_month == 5)
{
londonSummer = 1;
} // end if
if (si_month == 6)
{
londonSummer = 1;
} // end if
if (si_month == 7)
{
londonSummer = 1;
} // end if
if (si_month == 8)
{
londonSummer = 1;
} // end if
if (si_date >= 25 && si_year == 2007 && si_month == 2)
{
londonSummer = 1;
} // end if
if (si_date >= 30 && si_year == 2008 && si_month == 2)
{
londonSummer = 1;
} // end if
if (si_date >= 29 && si_year == 2009 && si_month == 2)
{
londonSummer = 1;
} // end if
if (si_date >= 28 && si_year == 2010 && si_month == 2)
{
londonSummer = 1;
} // end if
if (si_date < 28 && si_year == 2007 && si_month == 9)
{
londonSummer = 1;
} // end if
if (si_date < 26 && si_year == 2008 && si_month == 9)
{
londonSummer = 1;
} // end if
if (si_date < 25 && si_year == 2009 && si_month == 9)
{
londonSummer = 1;
} // end if
if (si_date < 31 && si_year == 2010 && si_month == 9)
{
londonSummer = 1;
} // end if
var newyorkSummer = 0;
if (si_month == 3)
{
newyorkSummer = 1;
} // end if
if (si_month == 4)
{
newyorkSummer = 1;
} // end if
if (si_month == 5)
{
newyorkSummer = 1;
} // end if
if (si_month == 6)
{
newyorkSummer = 1;
} // end if
if (si_month == 7)
{
newyorkSummer = 1;
} // end if
if (si_month == 8)
{
newyorkSummer = 1;
} // end if
if (si_month == 9)
{
newyorkSummer = 1;
} // end if
if (si_date >= 11 && si_year == 2007 && si_month == 2)
{
newyorkSummer = 1;
} // end if
if (si_date >= 9 && si_year == 2008 && si_month == 2)
{
newyorkSummer = 1;
} // end if
if (si_date >= 8 && si_year == 2009 && si_month == 2)
{
newyorkSummer = 1;
} // end if
if (si_date >= 14 && si_year == 2010 && si_month == 2)
{
newyorkSummer = 1;
} // end if
if (si_date < 4 && si_year == 2007 && si_month == 10)
{
newyorkSummer = 1;
} // end if
if (si_date < 2 && si_year == 2008 && si_month == 10)
{
newyorkSummer = 1;
} // end if
if (si_date < 1 && si_year == 2009 && si_month == 10)
{
newyorkSummer = 1;
} // end if
if (si_date < 7 && si_year == 2010 && si_month == 10)
{
newyorkSummer = 1;
} // end if
if (sydneyHours == 0)
{
sydneyHours = 24;
} // end if
if (londonSummer == 1)
{
londonHours++;
sydneyHours--;
} // end if
if (newyorkSummer == 1)
{
newyorkHours++;
chicagoHours++;
} // end if
if (hongkongHours < 10)
{
hongkongHours = "0" + hongkongHours;
} // end if
if (singaporeHours < 10)
{
singaporeHours = "0" + singaporeHours;
} // end if
if (mumbaiHours2 < 10)
{
mumbaiHours2 = "0" + mumbaiHours2;
} // end if
if (dubaiHours < 10)
{
dubaiHours = "0" + dubaiHours;
} // end if
if (londonHours < 10)
{
londonHours = "0" + londonHours;
} // end if
if (sydneyHours < 10)
{
sydneyHours = "0" + sydneyHours;
} // end if
if (chicagoHours < 10)
{
chicagoHours = "0" + chicagoHours;
} // end if
if (newyorkHours < 10)
{
newyorkHours = "0" + newyorkHours;
} // end if
if (hongkongHours == 24)
{
hongkongHours = "00";
} // end if
if (singaporeHours == 24)
{
singaporeHours = "00";
} // end if
if (mumbaiHours2 == 24)
{
mumbaiHours2 = "00";
} // end if
if (dubaiHours == 24)
{
dubaiHours = "00";
} // end if
if (londonHours == 24)
{
londonHours = "00";
} // end if
if (sydneyHours == 24)
{
sydneyHours = "00";
} // end if
if (chicagoHours == 24)
{
chicagoHours = "00";
} // end if
if (newyorkHours == 24)
{
newyorkHours = "00";
} // end if
_root.londonTime = londonHours + ":" + si_minutes;
_root.sydneyTime = sydneyHours + ":" + si_minutes;
_root.chicagoTime = chicagoHours + ":" + si_minutes;
_root.newyorkTime = newyorkHours + ":" + si_minutes;
_root.hongkongTime = hongkongHours + ":" + si_minutes;
_root.singaporeTime = singaporeHours + ":" + si_minutes;
_root.dubaiTime = dubaiHours + ":" + si_minutes;
_root.mumbaiTime = mumbaiHours2 + ":" + mumbaiMinutes;

View Replies !    View Related
UTC Timezone Issue
Ok, so I'm trying to set up a flash-based multiple time-zone display for my World of Warcraft guild website, so we (who are scattered across the globe) can coordinate things easier.

I'm probably doing something waaaay wrong, but here's the code. The displayed time stamps are all wacky, and it seems like everything is still being driven off my computer time-clock, not UTC. Any ideas?


Code:
var dNow:Date = new Date(); //initialize dNow as Date
var dms:Number = dNow.getUTCMilliseconds(); //Get UTC Values
var dsec:Number = dNow.getUTCSeconds();
var dmin:Number = dNow.getUTCMinutes();
var dhrs:Number = dNow.getUTCHours();
var ddate:Number = dNow.getUTCDate();
var dmonth:Number = dNow.getUTCMonth();
var dyear:Number = dNow.getUTCFullYear();

var nUTCDate:Number = Date.UTC(dyear, dmonth, ddate, dhrs, dmin, dsec, dms); //Get epoch milliseconds for current UTC date

var nESTDate:Number = nUTCDate - 18000000; //Adjust for GMT-5hrs (in milliseconds)
var dEST:Date = new Date(nESTDate); //Convert back to date

var nPDTDate:Number = nUTCDate - 28800000; //Adjust for GMT-8hrs (in milliseconds)
var dPDT:Date = new Date(nPDTDate); //Convert back to date

var nHSTDate:Number = nUTCDate - 36000000; //Adjust for GMT-10hrs (in milliseconds)
var dHST:Date = new Date(nHSTDate); //Convert back to date

var nAUSDate:Number = nUTCDate + 36000000; //Adjust for GMT+10hrs (in milliseconds)
var dAUS:Date = new Date(nAUSDate); //Convert back to date

clock_est.text = dEST; //Display timestamp in dynamic text boxes
clock_pdt.text = dPDT;
clock_hst.text = dHST;
clock_aus.text = dAUS;

View Replies !    View Related
Timezone Clock Help?
i am trying to make a clock which shows Sydney, Australia time no matter where in the world you view it. (similar to the two timezone on the www.weworkforthem.com site). any help would be hugely appreciated as i'm an actionscript moron.

View Replies !    View Related
Weird Time Different Timezone?
I have a mc that only plays between certain times. For example at 12:50 for 20 minutes and at 9:15 for 10 minutes. I have made it like this:

var myDate = new Date();
var hour = myDate.getHours();
var minutes = myDate.getMinutes();

if (hour>12 && minutes<15) {
this.gotoAndPlay(35); // code1show
}
else if (hour>19 && hour<21 && minutes<59){
this.gotoAndPlay(60); // code2show
}
else {
this.gotoAndStop(5); // nocode
}

With thanks to someone on this site
The weird thing is that the time works perfectly, but only if I set it to play 1 hour before it should start and 1 hour after it should stop.

The second time should be between 20:00 and 20:59. But if I put that in, it doesnt work. What am I doing wrong?

View Replies !    View Related
Getting Time From A Specific Timezone
Any idea how I can get the time from a specific time zone and use it in flash? Not necassarily the user's time.

Muchas nachos for any help.

View Replies !    View Related
Display Date/Time Regardless Of TimeZone?
The Flash Date object displays local time based on the viewers computer....how can I make it so it always displays the time in a certain timezone, regardless of the viewers location??

View Replies !    View Related
Gettign Timezone Code From Date
I have time in UTC format coming from a different application. Now i can convert it into browsers timezone and show the time properly.
However the problem is I want to show the Short code for time zone instead of TZD that is used by default.

I have searched a bit and found no solutions so far.

View Replies !    View Related
[CS3] Flash Count UP Clock Based In Another Timezone
I've found a few tutorials on count down clocks-- but I'm trying to make a count up clock based on a date in another time zone. Plus, when it reaches the final day, I need it to then play a movieclip.

Can anyone direct me to a good tutorial?

thanks for ANY input!!!

View Replies !    View Related
How Do I Set The _y Offset In DuplicateMovieClip?
This is my code:

var mc_target = "menu"+i;
var short_cut = _root[_root.present_design_target]

short_cut.nav_mc.menu_mc.menu0_mc.duplicateMovieCl ip(mc_target, i);

with(short_cut){
setProperty(mc_target, _y, -20);
}

But it does not work!

I'm greatfull for all answers

View Replies !    View Related
Color Offset
Hi everyone,

I posted a question on this a couple of weeks before, but noone seemed to pick up the gauntlet:

In Color.setTransform you specify the color of the object through six parameters (actually eight, but two regulate transparency): ra,rb
ga,gb
ba,bb.

r, g and b stand for (surprise) red, green and blue, and the xa value is the percentage of the color (-100 to 100). What I don't get is the xb value (ranging from -255 to 255) which supposedly represents the offset of the color.

Offset, schmoffset - can anyone explain what the f-k that means?

View Replies !    View Related
Swf Offset And It's Driving Me Mad...
I must be missing something here. My swf is 286X190 in size and I've inserted it into a table that is also 286X190. However, when the page loads, the swf resizes itself so that it's slightly skewed. Go here to see the page:
http://www.solartanthru.com/test2/header.htm

Any ideas?

View Replies !    View Related
Repeating Offset (?)
I apologize if this has been discussed before, however I don't have a clue what to call it. I'm trying to do what www.corbis.com does on their home page.

Would someone be kind enough to tell me what this is called or possibly post a link for a tutorial.

Thanks in advance!

View Replies !    View Related
What Does Offset Actually Do In SetTransform?
I am using setTransform to change a gradient backgrounds colour.

Everything is working fine, I have been give RGB values for the colours from the client.

Say colour a in the gradient is:

R=115 G=61 B=67 (kinda burgandy colour)

and colour b in the gradient is:

R=233 G=78 B=138 (kinda pinky colour)

And no transparency (alpha)

I converted the rgb value to %

colour a = 45,24,66
colour b = 91, 30.6, 54

Can anyone tell me how I create an object to replicate this gradient and what does the Offset values actually mean? Should they all be set to 0?


Code:
myColorTransform = new Object();
myColorTransform.ra = ?;
myColorTransform.rb = ?;
myColorTransform.ga = ?;
myColorTransform.gb = ?;
myColorTransform.ba = ?;
myColorTransform.bb = ?;
myColorTransform.aa = ?;
myColorTransform.ab = ?;


Would really appreciate some help

View Replies !    View Related
Rotation Offset...?
I have a child inside a parent Sprite. The child is able to move around, up, down, left, right by using arrow keys and the parent is able to be rotated. When the parent is rotated, the child moves up, down, left, right relative to it's parent. I need the child to still move up, down, left, right relative to the viewing area/stage.

How can I calculate the x, y, offset based on the rotation of the parent so that the clips inside are always moving straight up, down, left, right, diagonally when the parent is rotated?

View Replies !    View Related
Rotation Offset....
I have a child inside a parent Sprite. The child is able to move around, up, down, left, right and the parent is able to be rotated. When the parent is rotated, the child moves up, down, left, right relative to it's parent. I need the child to still move up, down, left, right relative to the viewing area/stage.

How can I calculate the x, y, offset based on the rotation of the parent so that the clips inside are always moving straight up, down, left, right when the parent is rotated?

View Replies !    View Related
ByteArray Offset
hi all..

Im parsing some byte data with the ByteArray class and wandered if anyone could help me in understanding the readBytes method a bit more clearly.

basically I think i found the result I need but its not working as I would expect it to.

example A)

so you see here i have an existing byteArray, and i want to copy some of that data into a new one. so i set the position of my existing bytearray.
now when i use the readBytes method it appears that it takes the offset to be the bytearrays current position + the offset i put in as a parameter. So the following does not appear to work.

byte_ar.position = myOtherClass.getOffset();

var buf:ByteArray = new ByteArray();
var pos:uint = byte_ar.position;
var len:uint = myOtherClass.getLength()

byte_ar.readBytes( buf, pos, len );


so i think its working the way i show below. (as im tracing numbers). but im setting the offset as 0. Now what i would have imagined to happen was that the entire byte array was copied as i have not specified an offset. but what appears to be happening is the offset is taking into account the current position in the byte array. but im yet to a point where i can make sense of my data. and so wanted someone to confirm this was correct?

byte_ar.position = myOtherClass.getOffset();

var buf:ByteArray = new ByteArray();
var len:uint = myOtherClass.getLength()

byte_ar.readBytes( buf, 0, len );


so my question is...

Can someone confirm that the offset parameter in the byte array class also takes into account the bytearrays current position. so in fact it is

current position + offset

any help would be appreciated.

View Replies !    View Related
Weird Offset In IE7
Starting somewhat recently, one machine in my studio started rendering a flash show incorrectly inside an iframe in IE7. Two other machines in the studio run the show perfectly and the machine that runs it incorrectly in IE7 runs it perfectly in Firefox. I'm trying to figure out why and how to fix this as it is my main machine. I've rebooted, I've run updates, nothing seems to correct the problem. I'm running XP SP2 (Media Center) on this particular machine.

I'd show you a screen shot or two, but I can't attach a PDF here.

Any ideas, advice, etc. would be warmly welcomed!

Thanks!

The page to test this on is: http://www.ccgcreativestudios.com/pctest.html

View Replies !    View Related
Offset Circle
I am trying to make a circle rotate on a different axis than the center point that comes with it naturally. I made the circle a symbol but it can only turn on its own axis set in the center. Can I make a new axis location and have it rotate around this new axis?

View Replies !    View Related
Scrollpane X-offset
Hi kirupers,

i work on a scrollpane pb.
i have an offset on the top and left side of a scrollpane component. This is an MX component in a flash 7 player.

i got content by some AS attaching clip with xml data driven/

i draw the scrollpane bg in black in order to see it.

How to remove this offset ?

here you can get the files

Thx for yr help

View Replies !    View Related
360 Rotation Offset
I have a little 360 view rotation thing i made, and now im modifying it to only show part of that view (180), the images i have for this are only 180. I have made a little greyed out spot on the compass and made it stop the arrow from going to that point, but now i need to offset the image that scrolls to be from north to south, but it's currently scrolling east to west.

Really hard to explain, heres a demo:

http://www.joshuajonah.com/compass.swf

heres the source:

http://www.joshuajonah.com/compass.fla


Heres a little snippet of the code sections:

on the image in the back
ActionScript Code:
onClipEvent (load){_global.degrees = (this._width-1360)/180}on(press){    startDrag(this, false)}on(release){    this.stopDrag()}  onClipEvent (enterFrame){    _y = 0}



on the maintimeline:

ActionScript Code:
stop()face.onPress = function(){face.onEnterFrame = function(){mouse_x = mouseTarget._x;mouse_y = mouseTarget._y;xDistance = mouseTarget._x - face._x;yDistance = mouseTarget._y - face._y;if (Number(xDistance)<0) {    normalise = -1 * xDistance;} else {    normalise = xDistance;}if (Number(yDistance)<0) {    normalise = Number(normalise)+Number((-1 * yDistance));} else {    normalise = Number(normalise)+Number(yDistance);}if ((Number(xDistance)>=0) and (Number(yDistance)>=0)) {    _global.direction = 90*(yDistance/normalise);} else if ((Number(xDistance)<=0) and (Number(yDistance)>=0)) {    _global.direction = Number(-1*90*(xDistance/normalise))+90;} else if ((Number(xDistance)<=0) and (Number(yDistance)<=0)) {    _global.direction = Number(-1*90*(yDistance/normalise))+180;} else {    _global.direction = Number(90*(xDistance/normalise))+270;}needle._rotation = _global.direction;image._x = -_global.direction*_global.degrees      }}face.onMouseUp = function(){    killdrag()}startmoving()onEnterFrame = function(){    if (needle._rotation<-90){        needle._rotation = -90    }else  if (needle._rotation>90){        needle._rotation = 90    }else{    needle._rotation = -image._x/_global.degrees}}function killdrag(){    delete face.onEnterFrame}


Any ideas? my brain hurts... thanx for giving it a go for me

View Replies !    View Related
Offset Duplicate MC From Original
hi is there a simple way i can make a duplicate MC offset the original so it doesn't appear exactly on top? thanks!

View Replies !    View Related
Relative Mouse Offset
This might be significantly more complex than I imagine, but forgive me, I am new. I am working with a widget I obtained from this site, a smart clip that generates a menu which scrolls in response to mouse placement (Yugo Style Menu). I am attemping to use it in a moveable popup window, but I can't seem to figure out how to make the mouse offset relative to the center of the window containing the clip as opposed to the center of the movie.

In other words, I want the precise center of the menu to be the precise center of the draggable window, regardless of where it sits on the screen.

Any help would be greatly apreciated.

-c.a.

View Replies !    View Related
Strange Offset With LoadMovie?
i think i am getting mad...
i am using flash since '98...
and i am using it very well...
but it seems that sometimes the brain stops working...

the problem:
i just import an external .swf file (pic1.swf) into a
movie clip (placeholder1) using:
loadMovie("pic1.swf",_root.placeholder1);

and it f***ing offsets it...

why in gods name???????????????????????????????????????

i am using the same dimensions for the pic1.swf and placeholder1-clip
...

you can download the file at (only 5KB) here

[start main.swf and click on the red dot...]
please help!
[Edited by deeno on 03-08-2002 at 11:56 AM]

View Replies !    View Related
Flash Image Offset Fix
I've been brawling with the bitmap offset problem for a while, and none of the usual fixes that people recommend worked for me.

Here is a solution that seems to work.

http://www.tinysuperbug.com/flashfix/flashfix.htm

Let me know what you think about this. Is this a plausable solution? Or will I run into problems later on?

If anyone could try this, And give me some feedback on whether or not it works for them too, that would be great.

View Replies !    View Related
Little Offset Question.. (sorry, Bad Title)
Hey, check out the attached FLA. You'll notice the pulsing buttons in the center. I would like to have them pulsing, but not at the exact same time. If you mouse over one of the pulses, it does its OVER animation, then returns to pulsing, but offset, like i want it to..
One easy option would be to make a few more frames and just place them onscreen on separate frames.. I'd like to figure how to do this by script.. Call me weird, but i like have a one frame backer for my movies to load into....

Anyway, check the fla, and post back if my request doesnt quite make sense.. Best way is to look at it and run the mouse over all the buttons, then look at the way they pulse in reference to each other... That's what i want..

thanks,
-myk

View Replies !    View Related
Image Distored, 1 Px Or So Offset
I am getting a 1 px distortion at 100%, but when I zoom in it is gone. I have made sure my image is a normal number size and does not have decimals in it.

This has happened to me so many times, and I want to finally figure out why. Below is a link to my SWF.

http://tc.newtidegroup.com/flash.html

You will see the distortion in the logo. Your help is much appreciated!

View Replies !    View Related
How To Offset Sound In A Frame?
Another newbie question.
I have a sound loop, and I dropped it into the first frame of my movie, and I really like the "fade-in" feature in Flash to introduce the sound.

But I would really like to start the loop with an offset (i.e. not fromthe beginning but from the 10th second).

Now, I know that you can do this:

MySound = new Sound();
MySound.attachSound("loop.mp3");
attachSound.Start(10);

But then the whole "fading in" thing sounds like a huge actionScript headache (at least for a beginner like myself).

So is there an easy way to do both: take advantage of the "fade-in" feature, and start the sound with an offset?

Thanks in advance!

View Replies !    View Related
Movie Clip Offset
Hi all,

I have a movieclip that continues into the negative x and y field (i.e. the center 0,0 of my movieclip is not the top left of my movieclip). With actionscript, I can determine its position relative to its parent (= the position of the center 0,0 of my movieclip) and its width and height.

But I don't know how to determine its "offset". By offset I mean the amount of pixels my movieclip occopies on the negative side of its own axes. So in other words my question might be "how do I determine the bounding box of my movieclip?". I couldn't find anything on this on the forum, so I'd be glad if anyone can help me.

I need this to draw dynamic masks. If I draw them from coordinates [0,0] to coordinates [myMC._width,myMC._height] they don't cover the part of my movieclip to the left and above its origin.

Thanks!

View Replies !    View Related
Scrollbar Offset Issue
Hey I was just working on the easy scrollbar tutorial off this site, Everything works great except for when i click the scrollFace, it offsets about 20 pixels to the right? I was looking through the code and I couldnt figure it out, I have redesigned the complete scrollbar in my own project and tried to make new scrollfaces,
Any suggestions for fixing this problem would be greatly appreacitated,

I think it has something to do with this code

startDrag(this, false, left, top, right, bottom);

Thanks,
GP

Thanks

View Replies !    View Related
Massive Sound.start(7,0) Offset Bug
Has anyone noticed that on setting an offset value to the start() method eg
Code:
mySound.start(7,0);
of a long 10 seconds + sound length, the sound fails to play all the way through to the end when you use a high offset!

Eg try the following code with a sound of around 10-20 seconds in length:

On _root

Code:
mySound=new Sound(this);
mySound.attachSound("soundtoAttach");



Code:
//on button 1
_root.mysound.start(0,0);

//on button 2
_root.mysound.start(3,0);

//on button 3
_root.mysound.start(8,0);
//on button 4
_root.mysound.start(10,0);


I think this is a bug as it gets the offset correct and plays the sound, but fails to reach the end!
Cheers

Sam

View Replies !    View Related
(x, Y) Corner Coordinates Offset When Zooming
Hello!

I have a math roadblock, and was wondering if anyone can help me out here. I'll try to explain.

In 2 consecutive frames, I've placed 2 versions of the same street map:

In frame 1:
* 1x zoom factor (zoomed out -- detail not so vivid)
* map size 2128w x 1797h

In frame 2:
* 2x zoom factor (zoomed in -- lots of detail)
* map size 4256w x 3593h

Now, both of the maps are big, but on each frame I've placed a mask layer onto the stage to make only part of it visible. (The mask is a 776x452 rectangle, and its upper left corner is perfectly aligned with the stage corner at (0,0).) By pressing the mouse over the map, users can drag it within that mask window and reveal any portion of it. On my stage I've also placed "zoom" buttons that let users toggle between the two sizes (e.g. jumping from frame 1 to frame 2 switches map zoom factor from 1x to 2x).

The .swf is pretty big, and I've actually simplified the problem for this posting, so if at all possible I'd like to avoid having to post anything. I hope this is clear so far!

OK, now the fun math part: Let's say I'm looking at the map in frame 1 (1x zoom factor). Let's also say I've dragged it around on the stage because I want to find the location of my house. Having done that, I position my house (represented by some (x,y) coordinate) in the _exact center_ of my view window -- i.e. at stage coords (776/2,452/2) or (388,226)....

NOW, I'd like to zoom in and get a closer look at my house, so I would hit the button that takes me from frame 1 (1x zoom) to frame 2 (2x zoom). In theory, I should now be able to see my house, plus a smaller radius of surrounding environs, in closer detail. And my house should still be positioned on the center coordinate within the view window.

If you sketch this on paper, you'll see that for my house's (x,y) coords to remain positioned in the center of the view window on both maps, the upper-left corner (x,y) coords of the full maps (imagine that there's no mask and you can see entire maps laid out in front of you, spilling beyond the edges of the stage) will vary depending on the zoom factor. Initially, when I first located my house in frame 1, the corner coords for the 1x zoom map were positioned at some location (ax,ay). Then, after I zoomed into the 2x map in frame 2, the map is now twice as big, so its corner coords (bx,by) have shifted upward and to the left some amount.

I'm looking for the forumula that converts (ax,ay) to (bx,by). It should be in a general form that says:

bx = ax (with the application of some genius math magic)
by = ay (with the application of some genius math magic)

Remember: x and y coords in this case refer to the upper lefthand corner position of the maps on the stage. In my example above, if by some amazing coincidence my house happened to be located on the 1x map such that its position aligned exactly with the center view window coords (388,226), then the corner (ax,ay) coordinates -- for both the map and stage -- would be (0,0). To zoom in on my house in that position, while keeping my house in the center of the view, the 2x map's corner (bx,by) coords would be offset into negative x and y vales, because the map grew in size and its upper left corner has overflowed off the stage.

One final clarification: I am indeed using two separate map files for this, as opposed to one single hi-res map whose _scale is adjusted down by a zoom factor variable. Sadly, I had to do this because altering _scale distorts the map detail.

Hope this makes sense! Glad to clarify if I've muddied the waters....

Cheers,
Maggie

View Replies !    View Related
Drag Two Objects At Same Time (offset)
Hi i have an image of a computer (imac) when it loads you can move mouse around (startdrag)

I want a cursor to move with the mouse, how do I do this.?

I have this code on the mouse MC

onClipEvent (load) {
if (_name == "follower") {
startDrag(this, true, 220, 150, 260, 190);
}
}


Ive got a MC called pointer for the cursor on screen.

I will have to mask this prob,

Please have a look at the FLA.

THANKYOU

View Replies !    View Related
Images Getting Slightly Offset When Published
Whats up guys.

I have a movie in MX where I sliced up a bunch of images and I need them to fit right back in place (just like an html page). I lined up the images tediously and they look great in flash, just like in my photoshop file. When I publish the movie however all the images get slightly offset. Because they need to line up to the pixel, it completely ruins the integrity of the movie.

My publish settings are to NOT compress movie, and the jpeg quality is at 100%. I also changed all the images' properties to PNG after reading a recent thread but to no avail.

Check the attachments for screenshots of both cases. Notice the odd line at the top of the buttons, and the white lines seperating the pics are gone.

*Also notice that the text isn't as crisp, any ideas on that?

I will also add that in MX 2004 this isn't an issue...but I can't handle the "expert mode" so I was hoping to do it in MX 6.

Thanks guys, I'd really apreciate any help.

View Replies !    View Related
Button Hot Spots Offset In Html?
I have just encountered a very odd problem. It seems, in my most recent project, unless the browser window is expanded large enough to accommodate for the full size of the flash file, the button hot spots are offset above their given buttons. So if you resize the browser window to cover the bottom 40 pixels of the flash file, the button hot spots would then be 40 pixels above the actual button.

It might just be a Firefox thing, as everything still seems to work normally in IE, however, over the past few weeks nothing has been very consistent so...

Has anyone ever experienced anything like this?

View Replies !    View Related
[Math] X And Y Offset Of New Point On A Circle
i have a circle with an object at 12:00 on the circle.

i need to create another object on that circle 72° clockwise from the first object.

what is the formula to figure out the offsetX and offsetY from the original object.

radius of the circle is dymanic, so just use "r"

heres a picture of what im talking about.

http://www.wwcclient.com/math-question.jpg

View Replies !    View Related
Offset Property (a Bug In The Sound Object)?
Hi, can anyone confirm that there is a bug in the offset property / Sound objects start([offset], [no of loops]) method!

Basically offset works as it should starting the sound at the offsets no of seconds, but fails to play all the way to the end and stops playing the sound before it should!

Any ideas, nothing on technotes at Macromedia and nothing wrong with my code, so i just need confirmation that it is a bug to save me wasting my time!

Try offsetting a long 10-15 secs + sound at 7 secs offset, start the sound and you'll see it doesn't reach the end!

Cheers

Sam

View Replies !    View Related
Objects In Circle Have A Weird Offset
Hello mates !

i'm confused. I made a script which nicely distributes small mc around a center, in a circle path.

The number of small mc will vary.

Now, if i use 16 objects, no problem. But if i use 9 objects, they are all offset on the x axis.

have got no idea why, and u ?

here is my code:


PHP Code:



onClipEvent (mouseMove) {
//problematic value herebelow
    nombreMetacompetences = 9;
    angle = (2*Math.PI)/nombreMetacompetences;
    radius = 140;
    myAngle = 0;
    for (i=0; i<nombreMetacompetences; i++) {
        myAngle = i*angle;
        myDistance = 120;
        myX = myDistance*(Math.cos(myAngle));
        myY = myDistance*(Math.sin(myAngle));
        // creating the metacomp square
        myMC = "carremc"+i;
        myDepth = i+100;
        this.attachMovie("carremc", myMC, myDepth);
        this[myMC]._x = myX;
        this[myMC]._y = myY;
        //+++++++++++++++++++++++++++
        // drawing background
        //+++++++++++++++++++++++++++
        this.createEmptyMovieClip("lin_"+i, i);
        //create an emptyMC for each line
        this["lin_"+i]._rotation = i*Math.round(360/nombreMetacompetences);
        this["lin_"+i].lineStyle(.1, "0xFFC266", 100);
        this["lin_"+i].moveTo(0, radius);
        this["lin_"+i].lineTo(0, 0);
    }





thanks for any help,

alex

View Replies !    View Related
Shape Movement Vs. Camera Offset FLA's
Ive been looking at the following tutorial: http://www.kirupa.com/developer/acti...ape_camera.htm but i can't seem to get it to work.

If anyone has completed this tutorial, is there any chance of you uploading the fla for me to play with...??

Im trying to use the Star/Space effect located at the bottom of the page.

Cheers

View Replies !    View Related
Offset Spacing For Unequal Thumbnails
Hello, like a thousand other users I am requesting some kind and knowledgeable soul to offer me help on a thumbnail gallery. My gallery is a conglomeration of code from several tutorials. Please ignore the excess comments, which I have kept so that I might modify the code.

Here is the problem:
I have a grid of thumbnails (partially masked)
and the thumbnails have different widths. I am looking for a solution
to evenly space these unequally sized thumbnails in the grid.

You can see I tried to use an if statement as well as using a variable that carries hte previous width of each image

I have been thinking my code might not be working how the images load in reverse, from the top of the array to the bottom. Also, the XML file does not fill the grid perfectly, as in the last row of images do not use all the columns in that row, I am wondering if it is a problem that I do not start from the 'end' of the row.

I am quite confused and would GREATLY appreciate your help.
I have put the thumbnail function code in blue, as that is where the placement of the thumbs occurs.

Thanks so much for your time.

Here is the code:


Code:
var thumb_spacing = 10;
var thumb_height = 80;
var prev_width = 0;
// number of columns you want
var columns = 5;
// number of rows you want
var rows = 9;
var positionX = 0;
// var to determine how much pages there will be
var pages;
// mask scroll mc
thumbnail_mc.setMask(mask);
var activate = 0;
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
thumbnails = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
thumbnails[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
thumbnails_fn(i);
}
//next two lines hide the thumbnail grid, until button makes them visible
thumbnail_mc._visible = false;
menu_mc._visible = false;
pages = Math.floor(total/5);
// /(rows*columns)));
// position of the different pages
//var pageing = pages*(columns*thumb_spacing);
trace("there are"+pages);
//if (pages>0) {
for (var i = 0; i<=pages; i++) {
// attach a button for each page
var pag = menu_mc.attachMovie("page_btn", "page"+i, 99+i);
// position of the btton
pag._x = 25+i*25;
//pag._y = 0;
// identifier for the button
pag.id = i;
// button text
pag.info.text = i+1;
pag.onPress = function() {
// show the right page
// you could add some easing...
thumbnail_mc._y = 486-(this.id*(thumb_height));
//-(i*(300));
};
}

firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
/////////////////////////////////////
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
prevImage();
} else if (Key.getCode() == Key.RIGHT) {
nextImage();
}
};
Key.addListener(listen);
previous_btn.onRelease = function() {
prevImage();
};
next_btn.onRelease = function() {
nextImage();
};
/////////////////////////////////////
p = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 10;
}
}
};
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
desc_txt.text = description[0];
picture_num();
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
function thumbnails_fn(k) {
thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
tlistener = new Object();
//pages = Math.floor((k/(rows*columns)));
//trace ("the first pages var="+pages)
//var pageing = pages*(rows*thumb_height);
//var pageing = pages*(columns*thumb_spacing);
//var pageing = (columns*thumb_spacing);
tlistener.onLoadInit = function(target_mc) {
//not working because k starts at 44 not 0
if ((k!=total), (k/5)!=int(k/5)) {
target_mc._x = prev_width + thumb_spacing;
prev_width = target_mc._width + prev_width;
} else {
target_mc._x = 0;
prev_width = target_mc._width;
}
//target_mc._x = (k%columns)*(pageing+thumb_spacing);
//target_mc._x = (k%columns)*(target_mc._width+10);
//target_mc._x = (k%columns)*170
// thumb y position
target_mc._y = (Math.floor(k/columns)%rows)*thumb_height;
//target_mc.createEmptyMovieClip("thumb_container", 0);
//target_mc.thumb_container.loadMovie(currentPicture.attributes.thumb);
//
target_mc.pictureValue = k;
target_mc.onRelease = function() {
p = this.pictureValue-1;
nextImage();
};
target_mc.onRollOver = function() {
this._alpha = 50;
thumbNailScroller();
};
target_mc.onRollOut = function() {
this._alpha = 100;
};
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);
}
function showgrid() {
if (activate==0) {
thumbnail_mc._visible = true;
menu_mc._visible = true;
activate++;
} else {
thumbnail_mc._visible = false;
menu_mc._visible = false;
activate = 0;
}
}

View Replies !    View Related
Pixel Offset On Imported Bitmap
When I import a bitmap from Photoshop (could be a png, gif, or tiff), it displays properly while playing on the stage, but in test movie, or published, it draws with an extra pixel on the top and left, and less one pixel on the bottom and right.

I get the same result whether or not the movie size is the same height as the graphic, or larger, or whether I import to Library or to stage, or drag to the stage.

I've worked around this before using a mask, but then I only had to mask the left side. I've been searching all over and find nothing on this. Anyone have a clue?

View Replies !    View Related
CS3 Bug? Pasting To A Slide File Is Offset
I'm not sure if this is a bug or an expected behavior, but you can't cut from a
regular Flash file timeline and paste to a timeline in a Flash Slide Presentation without the results being offset. It seems the origin is in the center of the regular Flash file but in the top left corner of the Slide file. (Even though both stages are the same size.)

Starting with a CS3 standard AS2 Flash file,

When doing:
Select all;
Copy Frames;

Then pasting in a new empty Flash Slide Presentation, with the exact same stage size, in Frame 1 of Slide 1 using:
Paste Frames;

All of the newly pasted contents are offset, as if the center is at the top left of the Stage.

Is this a bug, or am I missing something?

Bug or not, we have to live with it, so is there a way to re-center all of the objects on the timeline all at once?

- C

View Replies !    View Related
Sound Offset When Exported To Video
Ok, I'm trying to finally wrap up a holidays cartoon based on HL2, and I need to export the movie as a DIVX. Problem is, there's some lip synching later on and the sound is offset by about .5 seconds.

I've tried exporting the video and audio separate and combining in Dr. Divx, but the same problem happens.

Exported the file is 4:22 seconds long, 700x350, and about 35mb with 128kbps audio.

P.S. I need help seeding this on bittorrent (however that works) once it's ready for release. If you'd like to please let me know

View Replies !    View Related
Papervision GreatWhite - Strange Offset
Hey guys,

I'm having some trouble with pv3d great white. I'm trying to do a panorama, so I've setup the usual objects (Scene, Camera, Viewport, Renderer) and created the sphere, on which I'm mapping my material.

Now. I've setup everything with coordinates to 0,0,0 and rotations to 0,0,0, but when I render the whole thing, my material (0,0) or my sphere (0,0) respectivly is set off about 101 degrees from the camera rotationX/rotationY (0,0).

My point is: shoudnt the camera look at 0,0 (where the begining and the end of my material in the sphere connect), when it's set to 0, 0?

Can anyone explain why this is?

Here's my code:
Code:

private function onAddedToStage( e : Event = null ) : void {

   _scene = new Scene3D( );
   _renderer = new BasicRenderEngine( );
   _viewport = new Viewport3D( stage.stageWidth, stage.stageHeight, true, true );
   _viewport.mouseChildren = false;         
   _camera = new Camera3D();
   _camera.x = _camera.y = _camera.z = 0;

   var bitmap : Bitmap = Bitmap( e.target.content );
   var matrix : Matrix = new Matrix( );         
   //   matrix.scale( -1, 1 );
   //   matrix.translate( bitmap.width, 0 );

   _bitmapData = new BitmapData( bitmap.width, bitmap.height );
   _bitmapData.draw( bitmap, matrix );

   _material = new BitmapMaterial( _bitmapData );
   _material.smooth = true;
   _material.doubleSided = true;
   _material.opposite = true;
   _material.interactive = true;

   addChild( _viewport );
}

private function buildSphere() : void {

   var distance : Number = Math.sqrt( (stage.stageWidth * stage.stageWidth ) + (stage.stageHeight * stage.stageHeight ) );                  
   var quality : Number = 32;
   _radius = distance / 1.5;
   _circumference = 2 * Math.PI * _radius;

   _sphere = new Sphere( _material, _radius, quality, quality );
   _sphere.x = _sphere.y = _sphere.z = 0;
   _scene.addChild( _sphere );
}

private function onEnterFrame( e : Event ) : void {
   _renderer.renderScene( _scene, _camera, _viewport );
}   

I appreciate any kind of help! Thank you

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved