PDA

View Full Version : moving from 30th june to 1st july


nite21
06-22-2008, 12:20 PM
hi i have a movieclip mc inside it there are two frames
frame1 contains mydata dynamic textfield and frame2 contains one loader movieclip to load image and two dynamic textfield TextHolder1 and TextHolder2

im displaying data and image based on times

suppose it is june 22
im showing mc frame1 on 11 am till 3:59 pm
and from 4 pm till next day june 23 10:59 am im showing mc frame 2

it works fine im using date1 variable as current date to display the text

here is the code

if(hours >= 16 && hours < 24)
{
mc.gotoAndStop(2);
mc.TextHolder1.text = nite2[date1];
mc.TextHolder2.text = nite3[date1];
if(a == 1)
{
loadMov(date1);
a=0;
}
}
if(hours >= 0 && hours < 11)
{
mc.gotoAndStop(2);
n=nite2[date1-1];
s=nite3[date1-1];
mc.TextHolder1.text = n;
mc.TextHolder2.text = s;
//mc.TextHolder1.text = nite2[date1];
//mc.TextHolder2.text = nite3[date1];
if(a == 1)
{
loadMov(date1-1);
a=0;
}
}

but what happens when im on 30th june and when i move to july 1
it shows me undefined for the condition hours >= 0 && hours < 11
since date1 is 1 (1st july) and date1-1 gives me 0 and so i get undefined

will someone help me in this
on 30th june 11:59 pm it shows me Test 30 but when it moves to 1st july it shows me undefined
i wanted it to Test 30 only in dyanamic textfield
i wanted to show when it moves from 30th june to 1st july the same text
mc frame 2

atomic
06-22-2008, 06:34 PM
Condition the display...

If date1-1 actually equals 0, then make it equal to 1...

if(date1-1 == 0){
date1 = 1;
...
}

nite21
06-22-2008, 06:35 PM
Condition the display...

If date1-1 actually equals 0, then make it equal to 1...

if(date1-1 == 0){
date1 = 1;
...
}

shall i post the file atomic friend

nite21
06-22-2008, 06:36 PM
Condition the display...

If date1-1 actually equals 0, then make it equal to 1...

if(date1-1 == 0){
date1 = 1;
...
}
i will try ok thanks atomic

nite21
06-22-2008, 06:38 PM
Condition the display...

If date1-1 actually equals 0, then make it equal to 1...

if(date1-1 == 0){
date1 = 1;
...
}

stop();
var a:Number = 1;
var nite:Array=new Array();
var nite2:Array=new Array();
var nite3:Array=new Array();
var imagenew:Array=new Array();
var xmlnew:XML=new XML();
xmlnew.ignoreWhite=true;
xmlnew.onLoad = function(success)
{
if(success)
{

for(i=0;i<31;i++){
var tmpDate = this.firstChild.childNodes[i].attributes.date;
nite[tmpDate]=this.firstChild.childNodes[i].childNodes[0].attributes.text;
nite2[tmpDate]=this.firstChild.childNodes[i].childNodes[1].attributes.text;
nite3[tmpDate]=this.firstChild.childNodes[i].childNodes[2].attributes.text;
imagenew[tmpDate]= this.firstChild.childNodes[i].childNodes[3].attributes.src;

}
}
}
xmlnew.load("data.xml");
function loadMov(val)
{
//trace(imagenew[val]);
mc.loader.loadMovie(imagenew[val]);
}
var n:Number;
var s:Number;
function checkTime()
{
var time = new Date();
//var date1= time.getDay();
var date1=time.getDate();
var hours = time.getHours();
var minutes = time.getMinutes();
var seconds = time.getSeconds();
if(hours >= 0 && hours < 11)
{
mc.gotoAndStop(2);
n=nite2[date1-1];
s=nite3[date1-1];
mc.TextHolder1.text = n;
mc.TextHolder2.text = s;
//mc.TextHolder1.text = nite2[date1];
//mc.TextHolder2.text = nite3[date1];
if(a == 1)
{
loadMov(date1-1);
a=0;
}

}

if(hours >= 11 && hours < 16)
{
mc.gotoAndStop(1);
mc.pages.for_text.mydata.text = nite[date1];
a=1;
}
if(hours >= 16 && hours < 24)
{
mc.gotoAndStop(2);
mc.TextHolder1.text = nite2[date1];
mc.TextHolder2.text = nite3[date1];
if(a == 1)
{
loadMov(date1);
a=0;
}
}
};
var intervalID = setInterval(checkTime,100);

nite21
06-22-2008, 07:18 PM
Condition the display...

If date1-1 actually equals 0, then make it equal to 1...

if(date1-1 == 0){
date1 = 1;
...
}

this shows me undefined nite2[date1-1]
nite2 is an array and date1 is current date

but i dont want current date that is july 1
but i wanted to display the 30th june date text

since 11 am till 3:59 pm mc frame 1
and 4 pm till 10:59 am mc frame 2 ( 4 till 11:59 and 0 till 10:59)

nite21
06-22-2008, 07:27 PM
hi atomic here is the attachment

when it is 11:59 pm on june 30 it shows me Test 30
and if it moves to 12 pm it should show me Test 30 also
but it is showing me undefined



im showing movieclip mc frame 1 on 11 am till 3:59 pm
and movieclip mc frame 3 on 4 till next day 10:59 am



pls help