Skip to content
This repository has been archived by the owner on Feb 6, 2020. It is now read-only.

Change the internal needsFlashPlayerHack call in Fussy.as and Reflector.as #7

Open
jeromedecoster opened this issue May 30, 2010 · 0 comments

Comments

@jeromedecoster
Copy link

Hello,

I think that the needsFlashPlayerHack method in the Fussy class can be optimized.

Currently you have an internal method :
http://github.com/sammyt/fussy/blob/master/src/uk/co/ziazoo/fussy/Fussy.as#L57

static function needsFlashPlayerHack():Boolean

But in the test case you call it :
http://github.com/sammyt/fussy/blob/master/test/uk/co/ziazoo/fussy/ReflectorTest.as#L19

reflector = new Reflector(Fussy.needsFlashPlayerHack());

My idea is to set a private static var or const like that :

public class Fussy
{
    public static const needsFlashPlayerHack:Boolean = checkFlashPlayerHack();
    // ....

private static function checkFlashPlayerHack():Boolean
{
  var versionNumber:String = Capabilities.version;
  var versionArray:Array = versionNumber.split(",");
  var osPlusVersion:Array = versionArray[0].split(" ");

  var major:int = parseInt(osPlusVersion[1]);
  var minor:int = parseInt(versionArray[1]);
  var build:int = parseInt(versionArray[2]);

  return !(major >= 10 && minor >= 1 && build >= 52);
}

And you can change the Reflector class like this :
http://github.com/sammyt/fussy/blob/master/src/uk/co/ziazoo/fussy/Reflector.as#L7

public class Reflector implements IReflector
{
private var cache:Dictionary = new Dictionary();

public function Reflector()
{
}

public function forType(type:Class):XML
{
  var description:XML = cache[type] as XML;

  if (description)
  {
    return description;
  }

  description = describeType(type);

  if (Fussy.needsFlashPlayerHack)
  {
    // ....

Thanks !
J.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant