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,051 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Web browser crash when play videos 24 350
black magic design 1 130
Actionscript in Flash 3 72
Can't enable Flash on Chrome 32 Windows 7 any more 2 29
This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
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 set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

821 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