Prevent Cache of SWF Files and Xml Content in Flash

by Nathan 19. August 2009 09:17

 

If you like the flash player to expire the content of the SWF file add the following line between your <HEAD></HEAD>  tags

<META HTTP-EQUIV="Expires" CONTENT="Mon, 04 Dec 1999 21:29:02 GMT">
for more information check out: 
http://kb2.adobe.com/cps/147/tn_14743.html 

 

To prevent flash caching xml data, you can use the cache manager extension. It basically adds a timestamp to the querystring so it looks like a unique request.

 

You can download this from here:

http://www.communitymx.com/content/article.cfm?cid=827ea

Once you install the extension the usage is quite simple:

xml.load(CacheManager.uncacheURL(XmlFileLocation));

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Flash

Calculating Elapsed Time ActionScript

by Nathan 27. July 2009 09:58

 

function calculateTimeElapsed(startTime:Date,endTime:Date) {
    
    var sHours = startTime.getHours();
    var sMinutes = startTime.getMinutes();
     var sSeconds = startTime.getSeconds();
    var sMilliSeconds = startTime.getMilliseconds();

    var eHours = endTime.getHours();
    var eMinutes = endTime.getMinutes();
     var eSeconds = endTime.getSeconds();
    var eMilliSeconds = endTime.getMilliseconds();
    
    var sTimeSpan = (sHours*3600*1000) + (sMinutes*60*1000) + (sSeconds*1000) + (sMilliSeconds);
    var eTimeSpan = (eHours*3600*1000) + (eMinutes*60*1000) + (eSeconds*1000) + (eMilliSeconds);
    return eTimeSpan - sTimeSpan;
    
}

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Flash

Dynamically Creating Movie Clips in Flash

by Nathan 16. July 2009 05:19

var myText:TextField;

for (var i:Number = 1; i<6; i++) {
        this["clip"+i] = new MovieClip();
        this["clip"+i].graphics.beginFill(0xFFFF00);
        this["clip"+i].graphics.drawCircle(40, 40, 40);
        this["clip"+i].x=i*80;
        myText=new TextField;
        myText.width=250;
        myText.height=250;
        myText.text="clip" +i;
        myText.x=10;
        myText.y=20;
        this["clip"+i].addChild(myText);
        addChild(this["clip"+i]);
}

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Flash

SWFObject 2.2 Released

by Nathan 23. June 2009 08:09

 

SWFObject 2.2 has been released and has a number of new features.

1. Improved DomContentLoaded emulation for Internet Explorer
2. Dynamic library support
3. Callback method for embedding Flash content
4. No more embed tags
5. Improved Flash Player version detection for non-Internet Explorer browsers
6. Improved Adobe Express Install
7. Improved createCSS method
8. Detected user agent properties are now public via the swfobject.ua object
9. No more conditional compilation directives
10. The option to switch off SWFObject's default show/hide behavior

 More information found here

http://code.google.com/p/swfobject/wiki/whats_new

 

 

An example to implement with javascript  is:

         <div id="flashHeader" style="height:200px">

Alternative Content

        </div>

        <script type="text/javascript">
            swfobject.switchOffAutoHideShow();
            swfobject.embedSWF("flashFile.swf", "flashHeader", "800", "180", "9.0.0", "expressInstall.swf");
        </script>  
 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Flash

Accessing Web Services in Flash AS2

by Nathan 22. January 2009 14:56

 

Here is some example code to access web services in Action Script 2

// Import the Service Library

import mx.services.*;

// define your web service URL, remember to have WDSL at the end

var webService= "http://www.mywebhost.com/webservice/service.asmx?WDSL";

var webService = new mx.services.WebService(webService);
var serviceStatus = true;
webService.onLoad = function (result)
{
    trace("Accessing Web Service: " + company.WebService);
}
;

 

 // to access a method in the web service

 function loadWebMethod() {

    var value1:String = 'test value';

    var value2:Number = 100;

    // set object to use web method called 'MyWebMethod'

    serviceObj = webService.MyWebMethod(value1,value2);

    serviceObj .onStatus = function(status) {
        trace(status);
    };

    serviceObj .onResult = function(result) {
        // Load Current Server Time
        trace(result.toString());
        var xml:XML = new XML();
        xml.ignoreWhite = true;
        xml.parseXML(result.toString());
        ServerTime.Year = xml.firstChild.attributes.year;
    };

    serviceObj .onFault = function(fault) {
        trace("Failed to Load WebService"+fault.faultCode+","+fault.faultstring);
    };
}

 

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

Flash

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen

About the author

I am a Website Developer and Designer based in Sydney, Australia. I have experience in developing websites and applications using various languages including C#, VB, C++, Flash (ActionScript), SQL and Linux. You can see some of my projects at www.nathanbaker.com.au

Page List