?
Solved

Best way to set this up.

Posted on 2003-03-24
39
Medium Priority
?
242 Views
Last Modified: 2011-09-20
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.
0
Comment
Question by:fredmastro
[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
  • 20
  • 18
39 Comments
 
LVL 6

Expert Comment

by:henryww
ID: 8197926
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 http://www.experts-exchange.com/Web/WebDevSoftware/Flash/Q_20560294.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
0
 
LVL 2

Author Comment

by:fredmastro
ID: 8197976
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.
0
 
LVL 6

Expert Comment

by:henryww
ID: 8198009
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 ...
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Expert Comment

by:henryww
ID: 8198010
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 ...
0
 
LVL 2

Author Comment

by:fredmastro
ID: 8198032
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.
0
 
LVL 6

Expert Comment

by:henryww
ID: 8198129
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
0
 
LVL 22

Expert Comment

by:rascalpants
ID: 8198135
did someone say pants?


rp
0
 
LVL 6

Expert Comment

by:henryww
ID: 8198158
HA HA HA HA ... yeah ...
0
 
LVL 2

Author Comment

by:fredmastro
ID: 8198541
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?
0
 
LVL 2

Author Comment

by:fredmastro
ID: 8198691
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.
0
 
LVL 6

Expert Comment

by:henryww
ID: 8198699
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...

0
 
LVL 2

Author Comment

by:fredmastro
ID: 8198702
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?
0
 
LVL 6

Expert Comment

by:henryww
ID: 8198730
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 ...
0
 
LVL 2

Author Comment

by:fredmastro
ID: 8198732
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.
0
 
LVL 2

Author Comment

by:fredmastro
ID: 8198739
ok will post, but I know it's your bed time.

0
 
LVL 2

Author Comment

by:fredmastro
ID: 8198776
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.
0
 
LVL 2

Author Comment

by:fredmastro
ID: 8198778
and why can't I edit the action manually? I'm using Flash MX.
0
 
LVL 2

Author Comment

by:fredmastro
ID: 8199981
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.
0
 
LVL 2

Author Comment

by:fredmastro
ID: 8200118
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!
0
 
LVL 2

Author Comment

by:fredmastro
ID: 8200120
Link is messaed up  it has spaces "http://www.hostedforyou.com/mastro/SB Guild Emblem2000.zip" is the link
0
 
LVL 6

Expert Comment

by:henryww
ID: 8204308
geees ... there is so many graphic ... this is going to take a long time man!!

0
 
LVL 6

Expert Comment

by:henryww
ID: 8204327
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 ...

0
 
LVL 2

Author Comment

by:fredmastro
ID: 8204331
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
0
 
LVL 2

Author Comment

by:fredmastro
ID: 8204360
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.
0
 
LVL 6

Expert Comment

by:henryww
ID: 8204386
that looks good...

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

@@?

0
 
LVL 6

Expert Comment

by:henryww
ID: 8204449
ok .. i will see what i can do ...
hang on ...
0
 
LVL 2

Author Comment

by:fredmastro
ID: 8211928
any luck on a sample?
0
 
LVL 6

Expert Comment

by:henryww
ID: 8211953
coming soon :)

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

cheers
0
 
LVL 6

Expert Comment

by:henryww
ID: 8212468
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??
0
 
LVL 2

Author Comment

by:fredmastro
ID: 8212506
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?
0
 
LVL 6

Expert Comment

by:henryww
ID: 8212614
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 ...

0
 
LVL 2

Author Comment

by:fredmastro
ID: 8212811
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?
0
 
LVL 6

Accepted Solution

by:
henryww earned 1600 total points
ID: 8212981
ok done ..

A) not in this case, i think the way u are doing it is the easy way even though it is painful

B)no ... it will be just fine do it as it is now ...

check this link out ..
i have changed quite a lot of things ... but u should be able to figure out how it works

http://www.smartclever.net/example/flash/emblem/sb.zip

cheers
0
 
LVL 6

Expert Comment

by:henryww
ID: 8219599
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

0
 
LVL 2

Author Comment

by:fredmastro
ID: 8219903
oh no sorry didn't download them yet.

fredmastro@fredmastro.com
0
 
LVL 6

Expert Comment

by:henryww
ID: 8220182
arr ... i have sent it ..
but it looks like the DNS is back on ... working with no problem ...
0
 
LVL 2

Author Comment

by:fredmastro
ID: 8221422
Thanks pefect, I'll work off this.

400points.
0
 
LVL 6

Expert Comment

by:henryww
ID: 8222975
u are welcome :) & thanks
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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 my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
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.

771 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