[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Create empty container of specific size in flash

Posted on 2009-02-21
10
Medium Priority
?
961 Views
Last Modified: 2012-05-06
I want to create a container on my stage (1024x760) of a certain size (332x288) at the coordinates x-38 and y-176.  How would I do this?
0
Comment
Question by:Dier02
  • 6
  • 4
10 Comments
 
LVL 4

Assisted Solution

by:ariestav
ariestav earned 1500 total points
ID: 23703347
By container, I take it you mean an object that you can place (or load) other objects into?  Do you want to do this with Actionscript or with the basic creation (authoring) tools in Flash?
0
 

Author Comment

by:Dier02
ID: 23703600
I want to load SWFs into the container when a button is clicked.  I want to create the container programmatically via actionscript.
0
 
LVL 4

Accepted Solution

by:
ariestav earned 1500 total points
ID: 23707693
To create the container movie via Actionscript 3, write this code in the first frame of your main timline:

var container:MovieClip = new MovieClip();

container.width = 332;
container.height = 288;
container.x = 38;
container.y = 176;

addChild(container);

--------------
Keep in mind that while the container movieclip will actually be on the stage at this point, you may not "see" anything because nothing is in the container.  You would have to write more code to add a child to the container, and you probably need to have another movieclip with a graphic symbol within it already in your library.

Good luck!
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Dier02
ID: 23708789
Is it the same code for Actionscript 2?
0
 

Author Comment

by:Dier02
ID: 23708839
Tried it but no luck
0
 
LVL 4

Expert Comment

by:ariestav
ID: 23711231
No this is not the same as AS2, sorry.
0
 
LVL 4

Expert Comment

by:ariestav
ID: 23711633
Also, are you getting any error messages from your output or compiler window after you execute the Actionscript?  Is your Flash file intended for AS2 or AS3?  


0
 

Author Comment

by:Dier02
ID: 23714898
No output message and intended for AS2
0
 

Author Comment

by:Dier02
ID: 23714942
I tried loading an SWF into the container using loadvars on a button but no luck
on (release) {
           loader.loadClip("screen.swf", container);
     }

Open in new window

0
 

Author Comment

by:Dier02
ID: 23738462
FYI


var loader:MovieClipLoader = new MovieClipLoader();
     this.createEmptyMovieClip("container",1);
       container.width = 332;
container.height = 288;
container.x = 38;
container.y = 176;

This works in AS2
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question