Jump to content
Search Community

Unload a single SWFLoader item by click

henrye4 test
Moderator Tag

Recommended Posts

Hi,

I'm using LoaderMax to dinamically load a lot of swfs for an educational project. The swfs are questions for the creation of school test.

I would be able to clic on a single swf and activate a switch with another or delete it, so the teacher can choose the appropriate question and create a personalized test for each student.

Can I activate a MouseEvent for loaded items by the queue?

Link to comment
Share on other sites

I'm having a hard time understanding your question.

 

If you set a width and height for your SWFLoader initially, it will create a ContentDisplay object right away that is at that size, so you can add listeners to it immediately.

 

var loader:SWFLoader = new SWFLoader("child.swf", {width:200, height:100, container:this});
loader.content.addEventListener(MouseEvent.CLICK, clickHandler);
loader.load();

function clickHandler(event:MouseEvent):void {
   trace("clicked ContentDisplay linked to the loader: "+event.target.loader);
}

 

Does that help?

Link to comment
Share on other sites

I appreciate your quickly answer, but the example is applicable only if you load a single swf (I think).

I load an array like this:

 

queue.append( new SWFLoader("swf/d"+questionlist[i]+".swf", {name:"question", estimatedBytes:126000, container:m, x:0, y:ynext, visible:true, autoPlay:false, requirewithroot:this.root}) );
ynext = ynext + h + 10;
queue.append( new SWFLoader("row1.swf", {name:"row1", estimatedBytes:1000, container:m, x:0, y:ynext, visible:true, autoPlay:false, requirewithroot:this.root}) );
ynext = ynext + 10;
queue.append( new SWFLoader("swf/r"+questionlist[i]+".swf", {name:"answer", estimatedBytes:126000, container:m, x:0, y:ynext, visible:true, autoPlay:false, requirewithroot:this.root}) );
ynext = ynext + hr + 10;
queue.append( new SWFLoader("swf/row2.swf", {name:"row-final", estimatedBytes:126000, container:m, x:0, y:ynext, visible:true, autoPlay:false, requirewithroot:this.root}) );

 

The "h" and "hr" are attributes on my XML to set the question and answer's heights.

The variable "ynext" is initially set to zero, and I add sequentially a question, a separation row, the answer, and a final row that separates one question to another.

I want activate a MouseEvent only on the "question" loader.

Sorry for my poor English.

Link to comment
Share on other sites

  • 1 year later...

Hello,

I have a huge loadermax with several SWFLoaders.

Now we have serious problems with mouseevent.CLICK Events on the child swfs.

 

I tried everything. but mouse clicks on a button inside the child are never fired.

Could it be that when the playhead is at the end of the slide and we put stop(); on the last frame, all events are blocked?

Link to comment
Share on other sites

No, LoaderMax wouldn't block anything like that. It sounds like maybe you either have a security problem or maybe you set mouseEnabled to false on one of the DisplayObjectContainers or there's something transparent over the top of it that is obstructing/intercepting the clicks. Tough to say without seeing your files, but those are some guesses.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...