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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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 …
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now