Hi there,

I have created a Flash movie, And i have the swf file,
This swf is local, I want the swf file to expire on a particular system date..
Its like when the the DATE is Expired, the swf cant play...

Any ideas, on How to do it?
I need this one to be solved urgenly.
Your help will be much appreciated..

Thanks,
Tryphy

Dani AI

Generated

Short summary for : expiring a local SWF is easy to implement but hard to enforce. A simple Date check inside the SWF will stop playback when the system clock reaches the expiry date, but that is trivially bypassed by changing the machine clock or by editing the SWF. 's manual-remove idea is workable for tight control, but automated and tamper-resistant options are outlined below.

Quick local check (ActionScript 3):

var expiry:Date = new Date(2008, 6, 17); // July 17, 2008 (months start at 0)
var now:Date = new Date();

if (now.getTime() > expiry.getTime()) {
    if (root is MovieClip) MovieClip(root).stop();
    // show an "expired" screen or disable UI
}

Add a simple tamper-detection using a SharedObject (Flash local storage). Store the last run timestamp and treat any run where the clock moves backward as suspicious:

import flash.net.SharedObject;

var so:SharedObject = SharedObject.getLocal("appData");
var nowMS:Number = (new Date()).getTime();

if (so.data.lastRun !== undefined && nowMS < so.data.lastRun) {
    // clock tamper detected — treat as expired
}
so.data.lastRun = nowMS;
so.flush();

Limitations and stronger solutions: local checks and SharedObjects can be cleared or bypassed. For reliable enforcement, validate against server time or a signed license token issued by a backend (SWF requests server time or a signed expiry token). Note that local SWFs cannot always contact the network without trust settings, and cross-domain rules apply, so server checks require adjusting Flash Player local-trust or publishing for network access. For higher assurance, package as an AIR application, use signed tokens (public key verification in the app), and obfuscate the compiled code to raise the cost of tampering. For simple, short-term needs the AS3 patterns above work; for real license enforcement combine server-side validation + signed tokens + obfuscation.

Recommended Answers

All 4 Replies

Forgot to mention that the file is in the local,..
Its not in the server.

Why not just remove the swf file when the time is up? Set a reminder in outlook or something.

Thanks for the reply...

Since i am new in this, How do we set a reminder in outlook to remove the swf?

I dont know how to do it..
Any ideas..

Thanks.
Tryphy

A reminder per se wont remove the swf. You would have to manually remove it from the directory housing it, but within Outlook you can go to the calendar module click on the New button and enter the date/time you want to remember to remove the swf. Make sure to check the box that you do want a reminder and as long as Outlook is open on the day you set, a box will appear telling you to remove the SWF.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.