Ok all.. lets add a few more little details.
FLAMES:
I made a small PNG (its not great im not a great graphics guy) with 4 states to it that when put into DX and be "animated".

Here is what it looks like when cloned 5 times (and shrunk to death!).

Steps:
- Create new object called FlameBG
- I used the 5x5 blank i made in the first part for the background image, set its transparancy to about 5
for now, it will be 0 when its done.
- I positioned this box so that it would be big enough to cover the candles so that i could make the flames
Children of this box, and then i would be able to "move" the box for the mini and large backgrounds.
- I made a new object called "Flame1" and made its animation state as shown:

- I Cloned the flames 4 more times.
- In order to make the flames look a little different, i made one's animation "style" set to "forward" then "backward" then "f + b" then "b + f".
- I made them all "children" of the FlameBG object, and positioned them over the candles.
Now for some more code:
In order to make the FlameBG move, i had to position it for the Large and the Mini cakes, and write down the top/left position for each background. Then I modified the code to move this when you clicked the mini/large buttons.
FT = Flame top, FL = Flame left
Code: vbscript
- Function SetMode(Mode)
- desktopx.Object("Birthday-CD-Flame-BG").visible = False
- Select Case Mode
- Case "Mini"
- desktopx.object("Birthday-CD-LargeBG").visible = False
- desktopx.object("Birthday-CD-MiniBG").visible = True
- FT = 48 : FL = 193
- Call SetINIValue("Mode","Mini")
- Case "Large"
- desktopx.object("Birthday-CD-MiniBG").visible = False
- desktopx.object("Birthday-CD-LargeBG").visible = True
- FT = 74 : FL = 204
- Call SetINIValue("Mode","Large")
- End Select
- desktopx.Object("Birthday-CD-Flame-BG").top = FT
- desktopx.Object("Birthday-CD-Flame-BG").left = FL
- desktopx.Object("Birthday-CD-Flame-BG").visible = True
- End Function
You will see i make the flames visibility= false before i move it, then i swap the backgrounds, then i make it visible again.
This way you dont see it "move".
Again, this is the main reason for using "Functions", I didnt have to modify the code where i Call the Mode, and i can still go in and add even more functionality to the swap at a later time (fades, etc).
As i stated in the previous tutorial we needed to make the day/month work for international users not just USA. To do this i went looking and found a function that the TRUE DX master VAD_M created called FormatDate.
This is an awesome function because you can pass it a date in m/d/y and it will format it in the locale's format.
Here is the function:
Code: vbscript
- '---- FIX DATE FOR ANY LOCATION
- Function FormatDate(xdate)
- On Error Resume Next
- Dim ,s1,s2,sx
- If instr(xdate,"/") > 0 Then
- s1 = "/"
- ElseIf instr(xdate,".") > 0 Then
- s1 = "."
- ElseIf instr(xdate,"-") > 0 Then
- s1 = "-"
- End If
- Set objShell = CreateObject("WScript.Shell")
- = objShell.RegRead("HKEY_CURRENT_USER\Control Panel\International\sShortDate")
- s2 = objShell.RegRead("HKEY_CURRENT_USER\Control Panel\International\sDate")
- Set objShell = nothing
- sx = split(xdate,s1)
- If left(LCase( ),1) = "d" Then = sx(1)&s2&sx(0)&s2&sx(2) Else = sx(0)&s2&sx(1)&s2&sx(2)
- FormatDate = FormatDateTime( ,2)
- Set = nothing
- Set s1 = nothing
- Set s2 = nothing
- Set sx = nothing
- End Function
Then we have to make a few changes to the GetBDay Function to CALL this new Function.
Code: vbscript
- Function GetBDay()
- BdayToday = False
- testDate = FormatDate(BMonth &"/" & BDay &"/" & year(now))
- CheckDate = IsDate(testDate)
- If CheckDate <> True Then
- Msgbox "Date: " & testDate & vbnewline & "is Invalid" & vbnewline & "Please select a new date"
- Call PrefsMenu()
- Else
- s = DateDiff("s", Now, testdate)
- If s > 0 Then
- BDate = cdate(testdate)
- Else
- testDate = FormatDate(BMonth &"/" & BDay &"/" & (year(now)+1))
- BDate = cdate(testdate)
- End If
- d = DateDiff("d", Now, testdate)
- If d= 365 Then msgbox "HAPPY BIRTHDAY!!"
- desktopx.Object("Birthday-CD-Mini-BDate").text = BDate
- End If
- End Function
IE:
testDate = FormatDate(BMonth &"/" & BDay &"/" & year(now))
This seems to have fixed the problem with the d/m/y vs m/d/y formats.
So now i have had a few people test it and it seems to be working.
It is saving the day/month/mode just fine, and seems to be doing the countdown.
The next hurdle is to make this do "something" special on the actual birthday.
I need input here, what should it do?
Play "Happy Birthday" or some other mp3 file?
Change the image to someone new?
What else?
PLEASE post and let me know what you think it should do.
RomanDA