Link to home
Start Free TrialLog in
Avatar of fredmastro
fredmastroFlag for United States of America

asked on

Best way to set this up.

Ok I don't know ActionScript just so you know you.


I'm making this Flash tool where you can cycle through pictures.
The problem is that I have 176 pictures, and each picture has 19 variations.

That's 3344 graphic files.


Well one way I thought was.. putting each main picture in a movie clip and on each frame place it's variations, 19 frames.

I'm also using JavaScript to talk to the flash movie, so in Java I tell it to move to frame ## on XXX movie clip.

So I started in thi route.. making a layer for each main picture in the main movie.  But then I'm having to hide all the other pictures by sending each movieclip to an empty frame.  So only one main picture shows.

Well this is getting tideous and rediculous and I'm sure there's got to be an easier way?  I've named all the pictures numbers.

So I'm thinking there's got to be someway to for me to have javascript tell Flash to swap pictures instead in the movie clip.

So I'm using the same movieclip but when I hit next in my javacript I can say  (GraphicFileName# + 1)  remove what's evers in frame 1 in MovieClipXXX and place this new graphic in frame one.

Or if there is some way to do an FS command that does that and I can call the FS command from javacript and send it the arguments.  Like FSCommmand "ReplacePic", "GraphicFile"

I'm not really sure how to go about it, so I'm trying to get ideas. Best idea or solution gets the points.  

Samples are most welcomed and will get more points.  But wait until I want to go your route before sending sample. fredmastro@fredmastro.com

Note: I didn't proofread this post, I'm tired.
Avatar of henryww
henryww

here is an example of how u can pass variable or use javascript to load the external jpeg ...

javascript function to tell a flash/movieclip to goto and play a frame

function symbol(n) {
     InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
     myFlash = InternetExplorer ? window.flashfile : window.document.flashfile;
     
     symVal += n;
     myFlash.TGotoFrame("symbol",symVal);
}



alternatively, a much easier way will be to load the jpg externally ...

i am doing an example for https://www.experts-exchange.com/questions/20560294/Preload-dynamically-loaded-jpgs.html

which u can use too ... and very similar to what u both are try to do.

hang on there ... i will upload the link soon
Avatar of fredmastro

ASKER

Well I can already have the go to movie frame down. Hey you were the one that helped me.  It works great.  

I'm just running into that I'm going to have 176  layers in my main movie, each with 18 frames in it, and having to hide all those layers each time someone pics a new picture.

This is doable, just sucks, going to take me forever and seems a lot of extra code looping through and hiding all the other layers.

So that's why I was wondering, if I could swap out the picture in the frame with a picture from the flash libray itself. since I have all the pictures in the library numbered in order.

I'll take a look at that example and get back to you.
ho yes ... too .... and i told u already ... :)

well, of course ...

no need, if u have all the sybmols in the library ...
then all u need is a different way to pass the variable and have a function to monitor changes and use attachMovie to attach the movieclip form the library to the stage .. .

i will give u a simple example ...
hang on there a little while ...
ho yes ... too .... and i told u already ... :)

well, of course ...

no need, if u have all the sybmols in the library ...
then all u need is a different way to pass the variable and have a function to monitor changes and use attachMovie to attach the movieclip form the library to the stage .. .

i will give u a simple example ...
hang on there a little while ...
Ok looked at other thread. I think it's over my head.

Method I'm using now. (which is working, I just think there is a better way, so I don't have to create so many movie clips and make it so cumbersome)

I create a movie clip, I drag in each 19 versions of picture 1.

Then in JavaScript (thanks to your help) I say, move to movie Picture1/Frame 3  (for picture 1 version 3)

Well if I continue this route I'll have to make 176 movie clips.


Method I thought I could do but need help if it's possible:

I make one movie clip. with one frame with DummyPicture0.gif

I tell Flash, replace DummyPicture0 in MovieClip with Picture1-3.gif

Then when the user hits the next button I calculate which picture there on and what version they way (I can do this part) so then I know they want picture 1 version 4 so I tell flash..

Replace Picture1-3.gif in movieclip with Picture1-4

So my simple question, is there a way to replace a picture in a movieclip through scripting.

If not possible through Javacript using Flash Methods, then can my Flash movie have a FS Command that does it based on the Arguments I send it? Then I can send it arguments from JavaScript.
yes ... quite right ...
is it back to ur original question the doll with pants and shirts etc ...

now if u have everything in the library already and they are all well organised and named properly...

for etc ...

doll1
doll2
doll3
... etc

pants1
pants2 ... etc


now make sure u have everything exported (linkage) with the properly ...

on ur main stage, create 3 (4?) movieclips, name them and layer them properly.

so u will have shield at the bottom layer, symbol on the 2nd layer ... etc ... i am not sure what the others are ..

name the clips like "shieldHolder", "symbolHolder" ... etc


on the 1st frame of the maintime line

// frame 1 - declare variables
var shieldNum = 1;
var shieldTTL = 30; // if u have 30 shields
var symbolNum = 1;
var symbolTTL = 20; // if u have 20 symbols
... etc
... etc

_root.shieldHolder.attachMovie("shield1","selShield",1);
_root.symbolHolder.attachMovie("symbol1","selSymbol",1);
... etc for the other elements


have the buttons to ready to change the current element.
eg. for the shield buttons, next shield & previous shield etc ...

// move next - button
on (release) {
    if (_root.shieldNum <_root.shieldTLL) {
   _root.shieldNum ++;
   _root.shieldHolder.attachMovie("shield" + _root.shieldNum, "selShield", 1);
}
}

// similarly for previous button
on (release) {
    if (_root.shieldNum > 1) { // i am assuming base = 1
   _root.shieldNum --;
   _root.shieldHolder.attachMovie("shield" + _root.shieldNum, "selShield", 1);
}
}

repeat for the other elements ... the buttons ...


DONE :)

see not hard ... if u have experience programming VB or JS alike ... this is similar stuff :)

cheers
Avatar of rascalpants
did someone say pants?


rp
HA HA HA HA ... yeah ...
ok let me look this over, where do I put this script? on the frame of the main movieclip itself?

Can I call this script from javascript?
There a way I can manually type this in? I keep havintg to figure out what to choose from the actions.

I made 3 Movie Clips, movBG (Background), movFG (Foreground), movSymbol (Symbol)

Then I went to frame 1 on main and made three layers, and droped the empty movie clips on each layer.

Then I went to actions on main movie and clicked on Set variable.. and added

BGNum = 0
FGNum = 0
Symbol = 0

BGTTL = 18
FGNum = .. this is where I don't know because I have 14FG's and each FG has 18 colors.

Same with symbols, 176 symbols and 18 colors for each.

so lost :p

Not sure how to add a varation of this:
_root.shieldHolder.attachMovie("shield1","selShield",1);
since I can't manually seem to type in what I want.
on the main timeline, and the buttons are in flash as well ... why do u need javascript again?

if u really have to have a button in javascript ... which i think is pretty silly to have the whole movie in flash and buttons in js ... then u can do it with the similar way as we did in the last example ...

but u need a function to monitor the change of the variables ... no ... that way it is even more complicated ... no ... no no ... don't do it like that ...

cheers man, bed time...

ARe you saying I need a movieclip stil for each possible set of FG's?

Or can not I know replace pictures in the FG?
FG?
....

no no .. all ur movieclips (symbols are in the library right???) ...

u need to export the symbols then u will able to use the movieclips from ur library with attachMovie ...

post the ur complete fla (zipped please) then i can have a look for u ...
ahh I can't take it :p lol

I'm only using vbscript to figure out the pictures I want.

Each FG is actually named...

##-##.gif

First ## is the number picture, 00 through 14
and sec ## is the color 00 through 18

Each Symbol is named S#-#-#.gif
# is the set, there's 10, but not need to know what picture.
Sec # is the symbol ID, 0 through 176
Third # is the color of the Symbol 00 through 18.

In VBScript I can calculate that #'s with +1 and -1 and then concatante it with the name of the file.

I don't know how to do that in Flash so that's why I'm not using it.

I don't know how to replace movies, I can't even figure out that line you told me.
_root.symbolHolder.attachMovie("symbol1","selSymbol",1);
because it won't let me type in the action box I can only select from choices.
ok will post, but I know it's your bed time.

One movie is what I was working with the SB Guild Emblems.fla

The other movie is the one I started new to try this example SB Guild Emblems - Henry.fla

The new on has all the BG's and FG's and 2 symbols in each color.

I didn't put anything int he movies, still not sure if I'm supposed to replace the movie or replace the file in the movie.
and why can't I edit the action manually? I'm using Flash MX.
Disregard that link...

I'm working on something here, I found I had to put it in expert mode, didnt' know that (never use action script)

so let me try out your idea now.
Ok Henry!!!

Download this one!
http://www.hostedforyou.com/mastro/SB Guild Emblem2000.zip

Info:

I've put comments on buttons, I tried to actually code on the 'Shield Pattern' left and right buttons.  I've added a bunch of movies, but only movSymbol1 and movSymbol2 have any graphics.   Same with movFG00 and movFG01

movBG never changes, only the frames change.

FG and Symbol mov have to be swaped out.

Maybe you can make some of it work for me? I'll up the points.

How much would it cost me $$$ to have you do it all for me if I supply all the graphics and setup the movClips? I could send via paypal!
Link is messaed up  it has spaces "http://www.hostedforyou.com/mastro/SB Guild Emblem2000.zip" is the link
geees ... there is so many graphic ... this is going to take a long time man!!

can u convert the files to jpg??
instead of embeding all in the flash, we can use a script to load the jpg in dynamically, ...

if that's ok with u ...
let me know how the files are organised, the prefix/suffix of the filename etc ...

oh :p can you just do one example? and I can take it from there?

Can you make the Symbol change to a different symbol and then change the color to another color.  Then I can see how to work it or do the rest myself.

up this to 350
And does it not help that I have say symbol 0  in the movSynbol0 movie? each color version on a frame?


Here's a workign exampling in Windows IE only that I Was able to do with your help. (because it's in vbscript)
http://www.theblooded.net/guildpreviewer/default.asp

To get an idea of how it supposed to work and what I'm trying to do.
that looks good...

... i am sorry ... but what exactly is the problem now?

@@?

ok .. i will see what i can do ...
hang on ...
any luck on a sample?
coming soon :)

i am about to go home and will start doing it soon :)

cheers
i looked through the comments and ur fla again...

i know what u are trying to do ...

now ... this is going to be a pain in the neck to either convert the library items to a movieclip and looping thru frames or ... using export and linkage ...

a few ways to do that in fact, if u have the patient and u want to do it perfectly right from the beginning ... ? are u? or u are running out of patient on that?

if u know flash & action script well, ... this will be a very challenging project, and u can do it so well, with flash, only a few symbols (vector graphics) and use setRGB to change the colors, i can see from the library that u don't have too many different graphics but changing colors which doesn't have to be a physical file or an individual symbol, just one and change the colors realtime (if they are drawn in flash again) ... right this is going to take sometime to trace and draw again, but u can have millions of color after that and even add a color picker for the user to choose the combinations they like ...

the second way ... which i think it would take a bit less time, as i said convert all the gifs to jpg (if u can't do it, send the upload the zipped file with all the gif and i can convert them for u) than, u can just use very simple script similar to the one that u have now and load the jpg in ur flash.

what do u think?

or i can just give u code to replace the movieclip??
Ok well the vector thing would be cool but the images can only be those colors, and they are already shaded a certain way to match that background and forgrounds. So I'll skip on that.

Now why gifs? I just went through (and still going, there's a 176 images total, times 19 colors (0-18)), and converted all the bmps I had to gifs and making them transparent.

So I could load a image file in my libray to the movie? that what your saying? in a layer? that's what I wanted to do originaly because then I could script out which image to load since I've named them all sequentially.

So.. I'd rather just have a line that says 'clear out layer 0, and place this image in layer 0, center'
That what you saying for your last example? Can I keep GIFs?
ok :) sure ...

let me get this right ...

for example, u have different symbols in different groups
each group u are going to have a movieclip for them ... right? say movSymbol0 and movSymbol1

now user can be playing with movSymbol0 and chosing different colors ... then switch to a different group movSymbol1 and again .. it will cycle thru each item and groups ... correct?

i can tell u this is going to be very painful for u to put in these frames ...

Yes that is correct, only because that's the only way I could think of doing it.

BUT

If you could show me how to replace the actual .gif pictures in the frame of the main movie with another then I could do it that way.

A:) So what would be a better way?

B:) Can I replace not the movie clips, but the actual .gif image file in the frame it self from the pics in the library on the fly?
ASKER CERTIFIED SOLUTION
Avatar of henryww
henryww

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
sorry fredmastro, have u download the files yet?

there is problem with the DNS and i am afraid u won't be able to download it for a short while, if u haven't done so ... please let me know and i will send u the files via email ...

cheers

oh no sorry didn't download them yet.

fredmastro@fredmastro.com
arr ... i have sent it ..
but it looks like the DNS is back on ... working with no problem ...
Thanks pefect, I'll work off this.

400points.
u are welcome :) & thanks