Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 07-06-2012, 09:14 PM   #1
Jaybomanly
Registered User
 
Join Date: Feb 2012
Posts: 10
Exclamation How to 'expire' a Flash file

On my current project, I need to have a published SWF(EXE) expire after a certain date. Here is some code:
ActionScript Code:
var now:Date = new Date(); var expDate:Date = new Date(2012,7,1);//year, month(-1), day if(now >= expDate){     _root.gotoAndStop(16); }else{     trace("Contine trial") }

As you can tell, this sets a date to stop working (jump to frame 16). The SWF works fine. My problem is when I publish this to an EXE file, it never jumps to frame 16.

What am I doing wrong??
Please help!
Jaybomanly is offline   Reply With Quote
Old 07-10-2012, 02:59 PM   #2
Prid
Prid - Outing
 
Prid's Avatar
 
Join Date: Oct 2009
Location: Halden, Norway
Posts: 1,191
Send a message via MSN to Prid Send a message via Skype™ to Prid
Default

I dunno. Try creating a textfield, and output the dates in that, and post back what is outputs, also, post back what it outputs in the SWF file as well
__________________
I have returned, and am now 18
Prid is offline   Reply With Quote
Old 07-10-2012, 04:47 PM   #3
arkitx
Senior Member
 
Join Date: Jan 2011
Posts: 703
Default

Go to Publish Settings then Choose Windows Projector and CLICK Publish.


Test the EXE.



__________________
Regards

arkitx
arkitx is offline   Reply With Quote
Old 07-11-2012, 12:33 PM   #4
fruitbeard
Senior Member
 
Join Date: Feb 2012
Posts: 218
Default

Hi,

You could do shared object from the beginning like so.

ActionScript Code:
stop(); var playAmount = 25; expireSo = SharedObject.getLocal("expireySo"); if (expireSo.data.startedOn == undefined) {     expireSo.data.startedOn = 1;     expireSo.flush;     usedTime.text = expireSo.data.startedOn;     //gotoAndStop(2);     trace("Contine trial"); } else if (expireSo.data.startedOn < playAmount) {     usedTime.text = expireSo.data.startedOn++;     //gotoAndStop(2);     trace("Contine trial"); } else if (expireSo.data.startedOn >= playAmount) {     usedTime.text = expireSo.data.startedOn++;     //gotoAndStop(3);     //fscommand("quit");     trace("Expired"); }

basically starts off with one when you play it, then adds every time you restart it.

change 25 to how many times allowed to play, i know its not dates, but it might get you started.

Last edited by fruitbeard; 07-11-2012 at 12:36 PM.
fruitbeard is offline   Reply With Quote
Old 07-13-2012, 03:28 PM   #5
suresh02sd
Registered User
 
Join Date: Jul 2012
Location: Brooklyn, NY
Posts: 34
Default

what you need is to have it connect to the web to really expire it.
if you are doing it locally its easy to hack it by just changing the local date.
so make it that the app needs to have a internet connection to load and you can even manage the time out on the server that way the app only has an ID for witch the server returns true or false if its active or not.
suresh02sd is offline   Reply With Quote
Old 07-14-2012, 10:01 AM   #6
fruitbeard
Senior Member
 
Join Date: Feb 2012
Posts: 218
Default

Hi,

not sure on how much a flash projector can communicate with remote stuff (if any) other than opening a html page in a folder and having the web page change location upon loading etc etc.

but for your expire movie try this
ActionScript Code:
stop(); //////// Set Expire Dates ExpireDay = 1;// Day in month ExpireMonth = 7;// July ExpireYear = 2012;// Year //////// Get todays date TheDate = new Date(); Months = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"]; TheDay = TheDate.getDate(); TheMonth = Months[TheDate.getMonth()]; TheYear = TheDate.getFullYear(); //////// Show todays date in textfield if wish ShowDate.text = TheDay + "/" + TheMonth + "/" + TheYear; //////// Check date against expire dates if (TheYear < ExpireYear) {     gotoAndStop(2);     trace("Continue trial"); } else {     checkMonth(); } function checkMonth() {     if (TheMonth < ExpireMonth)     {         gotoAndStop(2);         trace("Continue trial");     }     else     {         checkDay();     } } function checkDay() {     if (TheDay >= ExpireDay)     {         gotoAndStop(3);         trace("Expired");         //fscommand("quit");     }     else     {         gotoAndStop(2);         trace("Continue trial");     } }

my hobby: fgps.com/keith
fruitbeard is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:21 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.