?
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
Medium Priority
?
5,060 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
SandyCooke earned 1000 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

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 …
Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
Suggested Courses

777 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