Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic boxes

Status
Not open for further replies.
Dec 24, 2001
857
GB
How do I do the following:

* Create a dynamic box which can load pictures into it
* Have a button set a variable called picture and then have the above box load the picture which has the same name as the variable

If I can think of anything else I want I'll post it, or if you want any more info let me know.

Thanks
 
If you're using MX this is really easy as the loadMovie() action has been extended to allow you to load in .jpg images.

Just set up an area on the stage where you want your image to load and convert it to a movieclip then use this clip as a target that you can load your new image into.

loadMovie("myPicture.jpg","targetArea");

You can set the variable on the button easily too:

on(release){
picture="myPicture.jpg";
loadMovie(picture,"targetArea");
} Slainte

 
You can't have pictures (as such! - remember this though? -> inside a dynamic textbox in Flash 5. Nor can't you really in MX.
You have to use the scrollpane component to be able to scroll pictures, buttons and text, at the same time, in MX.

Using something like I did above, you could sort of have buttons in your dynamic textbox, that can load a corresponding picture.swf on another level or in a holder movie clip, but it would be outside the dynamic text box, and all your pictures would have to be included in your main movie. They couldn't be loaded dynamically as Wangbar as described, when using MX. Regards,

new.gif
 
You just need to do what wangbar suggested (works for Flash 5, too), but be aware that the SWF will only work if viewed with version 6 of the Flash Player. If you want a more universal solution, why not make separate movies each holding one of the picures you want to load in, and load the SWF instead of the image itself. Although not as readily dynamic, this is a tried and tested solution.
 
Read dynamic text box in your first question...
My mistake! I stand corrected!
Regards,

new.gif
 
I'll explain in a bit more detail what I'm trying to do, and then explain what I've done so far:

I'm creating a menu where there is a list of people. When you click a person, it sets a number of variables (e.g. picture, name, info etc) and then jumps to another page.

This new page is just a template where if you opened it up without using the menu, it would be completely empty; it has to pull its info from another location specified by the variables. I figured this would save me time instead of creating hundreds of unique pages for each person.

So far, I have the menu system with all the people in it, and the template page.
The page has space for the persons picture, their name, title and a box with some info in it.
Anything text based is easy to do; I just load the variables from a text file and this works.
The picture is the problem.

I tried Wangbars suggestion and took into account RGStewarts fact about having to use player 6. This allows me to import the picture which is great.
The next problem I have is how to resize the pictures because they're of quite high resolution. Is there a command where I can state the width and height, or percentage etc.

If you need any more info, let me know.

Thanks
 
To resize the pictures you'll have to use something outside of Flash because it will only load in files at full size - although you could use script to resize clips dynamically the results would be distorted and the filesizes would still be huge.

Have you got access to Fireworks or something similar like ImageReady? They're designed to do the resizing tasks you require and the whole process can be automated as a batch file to load, resize, optimise and rename images to save you the effort of manually adjusting each image. Slainte

 
I have Fireworks 4...you say that if I used script the images would be distorted and file sizes huge. Would this be the same if I was reducing the size of the clips?

At the moment, I think the images are 450x450, and I'll be reducing them to no bigger than 200x200. Also, sometimes I need to make them images for example 130x200, so I can't just say reduce the whole image by 50%.

Thanks
 
You need to use a photo editor as wangbar suggested. If you haven't used one before I would suggest you aviod batch processing for the moment. Fireworks would do fine, as would Image Ready or Photoshop. Failing that, Microsoft PhotoSuite, or JASC PaintShop Pro would both do fine as well. You need to open your image in the photo editor, use a resize command to make the image the physical proportion you want (if the image has to be square and it isn't to begin with, you may need to crop the required area before you resize).

Once you've done this, you need to optimise the filesize. I don't know much about any of the other packages, but in Photoshop you can choose "Save for Web", which gives you profiles under which you can save your image. I recommend JPG High Quality (60%) - that gives good quality images at low filesizes.

When you have made the image the right size, and reduced the filesize to as low as possible without sacrificing quality, import the image into Flash and you're ready to go. I suggest you leave the JPG compression at it's default - any more compression will start to pixelise the images.

This will save filesize in the SWF, because you are importing smaller files (ergo the Flash compression will be able to reduce a smaller original size even further) - you should notice a marked difference, especially if you are redcucing some images to more than 50% their original size!
 
Its ok, I got it sorted. I put the following into a button:

on (release) {
loadMovie ("test picture.jpg", "picturebox");
picturebox._xscale = 36.6;
picturebox._yscale = 53.3;
picturebox._x = 230;
picturebox._y = 49;
}
This allows me to scale down the picture and set where it goes.

Thanks for your help...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top