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 6720469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:12:57+00:00 2026-05-26T09:12:57+00:00

I am trying to access a function in a loaded swf that has external

  • 0

I am trying to access a function in a loaded swf that has external class..
I would like to avoid having to put the function on my “Main” Doc class in the external swf
and instead access the function directly from the class

This is what ive tried so far and it’s a no dice:

 private function startLoad(){
        var loader:Loader = new Loader();
        var req:URLRequest = new URLRequest("one.swf");
        loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
        loader.load(req);

    }
 private function onLoadComplete(e:Event):void{
        var ClassDefinition:Class = e.target.applicationDomain.getDefinition("com.view.Creative") as Class;
        var butn:MovieClip = new ClassDefinition(0,0);////0,0 is x and y cordinates I have in the "com.view.Creative" class

        this.addChild(butn);
        butn.setVar("one");////"setVar" is the function in my external swf with the class "com.view.Creative"
    }

This is the function in com.view.Creative.as

  public var storedVar:String

  public function setVar(str:String):void{
               this.storedVar = str;
               trace(storedVar)
    }

//Returns “ReferenceError: Error #1069: Property setVar not found on com.view.Creative and there is no default value.”

This is the other approach I took with no success

  private function startLoad(){
        var appDomain:ApplicationDomain = new ApplicationDomain();
        var context:LoaderContext = new LoaderContext(false, appDomain);
        var loader:Loader = new Loader();
        loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler); 
        loader.load(new URLRequest("one.swf"), context);


    }

  private function completeHandler(event:Event):void { 
        var myGreet:Class = ApplicationDomain.currentDomain.getDefinition("com.view.Creative") as Class;                
        var app : MovieClip = new myGreet(0,0)
        addChild(app);
        app.setVar("one");////set var is the function in my external swf with the class "com.view.Creative" I am trying to access
        //event.target.content.setVar("one");///this works if I am placing my "setVar" function on my "Main" Doc Class which I am trying to avoid///

    }

This is the function in com.view.Creative.as

   public var storedVar:String

   public function setVar(str:String):void{
               this.storedVar = str;
               trace(storedVar)
    }

//Returns “ReferenceError: Error #1069: Property setVar not found on com.view.Creative and there is no default value.
at com.util::ClickArea/completeHandler()”

There’s gotta be a solution for this…..Thanks in advanced!

  • 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-26T09:12:58+00:00Added an answer on May 26, 2026 at 9:12 am

    in second case try this :

     var myGreet:Class = event.target.applicationDomain.getDefinition("com.view.Creative") as Class;  
    

    event.target is Your contentLoaderInfo .

    If You loading swf into new ApplicationDomain , You cannot look for definition in currentDomain .

    in first case , maybe You already have class Creative under this alias but with different params and when You load swf to currentDomain , class :”com.view.Creative” will not overwrite existing , but return class from main swf.

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

Sidebar

Related Questions

I am trying to create a function that will block access to some of
I'm trying to pass a variable from my main swf to another one that's
I'm trying to access the post target action in a jquery function. example: <form
I'm trying to load external SWF ( JW Player ) into my AIR Application
I'm trying to access data of an Iframe's Iframe. To force my javascript function
I am trying to do the following: Main document calls a function in iFrame
what I'm trying to do is accessing snapText = scrollPane.source.textSnapshot; from an external swf.
I'm programming in C#. I'm trying to make a class, that when called will
Im trying to access a web service from a remote computer. I managed to
Im trying to access the Magento customer session in another part of my website.

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.