Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 361757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T13:10:46+00:00 2026-05-12T13:10:46+00:00

Hello all I was hoping to get some help with inported this class to

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T13:10:47+00:00Added an answer on May 12, 2026 at 1:10 pm
    var siteLock:SiteLock = new SiteLock()
    if(!siteLock.checkLock(this, ["mydomain1.com","mydomain2.com"]))
        siteLock.displayWarning();
    

    place this in the script at frame 0.

    I like this implementation of the concept better.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello all and thanks for the help, I need to write every row from
Hello all i'm turning objects on (adding the class .active) and off on a
hello all this seems to be my problem I have a table in mysql
Problem Hello all! I have this code which takes my jpg image loops through
Hello all C++ Experts, It's me again. I will get straight to the point.
Hello All I am trying to flatten a list in Ocaml. I am a
Hello all this is what I got: NSN:&nbsp;<input type=text name=filterCriteria(NSN).values value=/> <input type=hidden name=filterCriteria(NSN).fieldName
Hello all I hope someone can help me I am working on a simple
Hello All I am using Javascript to calculate some values of textboxes .The calculations
Hello all I am currently working on doing some research and was utilizing the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.