Solved

Actionscript: Dynamically create empty movie clip within a scroll pane, attach JPEG to that dynamically created movie clip

Posted on 2004-03-24
2
5,046 Views
Last Modified: 2008-03-10
I have a scrollpane.  I have many images I want to put in the scrollpane as thumbnails.  They need to be movie clips because I need to do stuff with them when the user clicks on them.  Like fades, alpha stuff, scaling, load another instance of that dynamically created movie clip into a different movie clip, etc.

So - can someone provide some example code of how to:

1 - Dynamically create a empty movie clip ("within" my scrollpane)
2 - Insert a JPEG into that dynamically created movie clip (from disk or URL, using loadmovie)

I would appreciate it if you could be very specific as well - but beggars can't be choosers.  Thanks in advance.

0
Comment
Question by:b2johnso
2 Comments
 
LVL 2

Accepted Solution

by:
SandyCooke earned 250 total points
ID: 10672123
I've never actually used a scrollpane but I'm pretty sure if you name it 'myScrollpane' then this will work:

totalimages = 6;
for (i=0; i<=totalimages; i++){
monkey = myScrollpane.createEmptyMovieClip("imageHolder"+i, i+10, 0, 40*i, 40, 40);
monkey.loadMovie("http://www.yourdomain.com/images/image"+i+".jpg");
};

You can then do other stuff with monkey (or whatever name you choose!) such as:

monkey.onRelease = function(){
// do something funky
};
0
 

Expert Comment

by:rowdypig
ID: 11086648
I just read the reply to this question in the hopes that it would help me with my diimma. Although it was concise, well-written (and actually cleared up a thing or two for me), it did not solve my problem. I would truely appreciate your help with this issue:

I need to take a MovieClip (lets call it clipSubject) and divide it into a number of pieces in a cartesian grid. As such, I guess I need to mask the clipSubject MovieClip to only show a sub-section of it.

So can I use the MovieScript.CreateEmptyMovie() constructor to create a new grid of MoveClips (all attached to each other) where each grid section (clipSection MovieClip) contains two layers:

clipSectionMovieClip  -- MovieClip
  |
  |
  ==> Layer 1:   clipMask - MovieClip
  |
  |
  ==>Layer 2:    clipSubject - MovieClip

If so, how do I control the x,y coordinates of the clipMask MovieClip on the first layer of the new dynamically created clipSection MovieClip?
also, how can I tell the new dynamically created clipSection MovieClip to treat the clipMask MovieClip as a mask?

finally, how do I decide where to create Class definitions for this project?

Currently I am leaning towards this:
==============================================
class megaClip extends MovieClip
  MovieClip object that contains an array of horizCLIP objects

class horizCLIP extends MovieClip
  MovieClip object that contains an array of sectionCLIP objects

class sectionCLIP extends MovieClip
  MovieClip object that contains two layers:
    layer 1: maskCLIP - MovieClip object
    layer 2: subjectCLIP - MovieClip object

=============================================

The entire goal, of course, is to create a dynamic MovieClip that when you mouse over it, the image appears to dimple where your mouse is by shrinking the size of it's corresponding pieces and enlarging the pieces that are not being moused over. the resolution of the dimple then would be determined only by the number of subdivisions you select for dividing the main image into (ideally this number would be setup to either have one divMax (maximum number of divisions being equal horiz and vertical) or hdivMax and ydivMax (for independently controlled x and y resolutions).

Sorry for the long post. I hope that someone has some advice for me rather than just "get a life, you moron" or "too much trouble for me". Any suggestions or information that you could provide would be greatly appreciated. Thanks in advance for you help.

Rowdy

rowdypig@yahoo.com
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Action Script commands 3 219
Consuming WCF in Action Script 3 [ flash Develop ] 3 314
Google Chrome pepflashplayer.dll 8 137
Animating text  - electrons orbit around letter M 12 79
This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to how to record live broadcast.

831 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