# \[FLASH+FLEX\] call a method in a flex swf from as3

**URL:** <https://forum.kirupa.com/t/flash-flex-call-a-method-in-a-flex-swf-from-as3/227199>\
**Category:** flash\
**Created:** [May 28, 2007, 12:43pm UTC](https://forum.kirupa.com/t/flash-flex-call-a-method-in-a-flex-swf-from-as3/227199 "2007-05-28T12:43:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tofuisonmyside](https://avatars.discourse-cdn.com/v4/letter/t/58956e/32.png) [@tofuisonmyside](https://forum.kirupa.com/u/tofuisonmyside)\
**Post date:** [May 28, 2007, 12:43pm UTC](https://forum.kirupa.com/t/flash-flex-call-a-method-in-a-flex-swf-from-as3/227199/1 "2007-05-28T12:43:37Z")

</div>

Hello

here it is:  
i have a flex file with methods inside and some as3 swf  
The idea is to load the flex file in as3 swf, and when flex file is loaded, call a method from the flex file

here is the code process

```auto
var _loader:Loader = new Loader();
var flexAppli:URLRequest = new URLRequest("flexfile.swf");
_loader.contentLoaderInfo.addEventListener(Event.INIT, onLoadInit);
_loader.load(flexAppli); 

```

and

```auto
[COLOR=#000000][COLOR=#006600]
private function [/COLOR][COLOR=#0000cc]onLoadInit[/COLOR][COLOR=#006600]([/COLOR][COLOR=#0000cc]event[/COLOR][COLOR=#006600]:[/COLOR][COLOR=#0000cc]Event[/COLOR][COLOR=#006600]):[/COLOR][COLOR=#0000cc]void 
[/COLOR][COLOR=#006600]{ 
   var [/COLOR][COLOR=#0000cc]loader[/COLOR][COLOR=#006600]:[/COLOR][COLOR=#0000cc]Loader [/COLOR][COLOR=#006600]= [/COLOR][COLOR=#0000cc]Loader[/COLOR][COLOR=#006600]([/COLOR][COLOR=#0000cc]event[/COLOR][COLOR=#006600].[/COLOR][COLOR=#0000cc]target[/COLOR][COLOR=#006600].[/COLOR][COLOR=#0000cc]loader[/COLOR][COLOR=#006600]); 
[/COLOR][COLOR=#006600]var [/COLOR][COLOR=#0000cc]newSprite[/COLOR][COLOR=#006600]:[/COLOR][COLOR=#0000cc]MovieClip [/COLOR][COLOR=#006600]= new [/COLOR][COLOR=#0000cc]MovieClip[/COLOR][COLOR=#006600](); 
   [/COLOR][COLOR=#0000cc]newSprite[/COLOR][COLOR=#006600].[/COLOR][COLOR=#0000cc]name [/COLOR][COLOR=#006600]= [/COLOR][COLOR=#cc0000]"LeFlexCharge"[/COLOR][COLOR=#006600]; 
   [/COLOR][COLOR=#0000cc]newSprite[/COLOR][COLOR=#006600].[/COLOR][COLOR=#0000cc]addChild[/COLOR][COLOR=#006600]([/COLOR][COLOR=#0000cc]loader[/COLOR][COLOR=#006600].[/COLOR][COLOR=#0000cc]content[/COLOR][COLOR=#006600]); 
   [/COLOR][COLOR=#0000cc]addChild[/COLOR][COLOR=#006600]([/COLOR][COLOR=#0000cc]newSprite[/COLOR][COLOR=#006600]); 
   [/COLOR][COLOR=#0000cc]setChildIndex[/COLOR][COLOR=#006600]([/COLOR][COLOR=#0000cc]newSprite[/COLOR][COLOR=#006600], [/COLOR][COLOR=#0000cc]0[/COLOR][COLOR=#006600]); 
   [/COLOR][COLOR=#ff9900]// here the method call[/COLOR][/COLOR][COLOR=#000000][COLOR=#006600]
   [/COLOR][COLOR=#0000cc]newSprite[/COLOR][COLOR=#006600].[/COLOR][COLOR=#0000cc]mymethod();[/COLOR][/COLOR][COLOR=#000000][COLOR=#ff9900] //dont work[/COLOR][/COLOR][COLOR=#000000][COLOR=#ff9900]
[/COLOR][COLOR=#006600]} [/COLOR][/COLOR]

```

The problem is : when calling the mymethod from flex file, it does not work

So i did a trace on all elements in as3 file and i get an object like this  
\_MyFlexAppli\_mx\_managers\_SystemManager

First question : What’s this ?  
Second Question : How to call my method ?

Thx for yr help  
tofu
