Hello all I was hoping to get some help with inported this class to a little game AS3
allowDomains:Array is a list of the allowed domains
My Question is where an how to write this Array and where to place it so all get compiled with Flash CS4.
class below.
package com.ikonicstudios.utils
{
import flash.display.DisplayObject;
import flash.display.MovieClip;
import flash.display.LoaderInfo;
import flash.text.TextField;
import flash.text.TextFormat;
//rootLevel:MovieClip is the location of the root timeline
//allowDomains:Array is a list of the allowed domains
//will return true is the domain is allowed, false if the domain is not allowed
//displayWarning dynamically adds a message across the screen
public class SiteLock extends MovieClip
{
public var domain:String;
public var rootLevel:DisplayObject;
private var warningText:TextField = new TextField();
public function SiteLock()
{
}
public function checkLock(rootLevel:DisplayObject, allowedDomains:Array):Boolean {
this.rootLevel = rootLevel
domain = rootLevel.loaderInfo.url;
for each(var allowed in allowedDomains) {
if (domain.indexOf(allowed)!=-1) {
return true;
}
}
return false;
}
public function displayWarning() {
var sh = rootLevel.stage.stageHeight;
var sw = rootLevel.stage.stageWidth;
var format = new TextFormat("_sans", 14, 0x000000, true, false, false, null, null, "center");
warningText.text = "This domain does not have permission to host this flash";
warningText.y = sh / 2 ;
warningText.width = sw;
warningText.setTextFormat(format);
warningText.selectable = false;
rootLevel.stage.addChild(warningText);
}
}
}
The class file runs alright when using Flash CS4.. But when i try yo use it in Flex builder, I get some warning. see below. anyone know how can can remove this warning, and fix the class to works in Flex builder. ? Thanks John
1008: return value for function 'displayWarning' has no type declaration. line 39 1008: variable 'allowed' has no type declaration. line 30 1008: variable 'sh' has no type declaration. line 40 1008: variable 'sw' has no type declaration. line 41 1008: variable 'format' has no type declaration. line 42