Snap shot of a movie

Okay…got the start of a small application the intention is that the user can save a snap shot of what they have done and can load it for modification or printing later etc.

The application allows the user to drag and drop an instance of a bunch of MC instances ie person, people and computer (more will come but these for now) onto the stage which gives them a incremental instance name.

The description window shows what objects have been duplicated and in the order they were dropped…the user can hover over an instance and then hit the ‘D’ key which deletes the object and updates the description order.

The user can hit the ‘L’ key then click on an instance on the stage then click on another instance which draws a red line between the two, snapped to the centre (Not happy with the line, want a red arrow which does not overlap the instance object but forget that for now that is not the important bit)

This is the important bit:

After the user has finished dragging and dropping etc:

  1. The user clicks the save button I want the app to save all the details of all MC’s on the screen including the description text to be saved (Like with your scribble app Ahmed…may be x,y, instance name etc)

Click clear…

  1. The user clicks load button they can choose previously saved snap shots that were saved as in number one above.

I have been going mad :trout: …thinking of where to start XML, sharedobjects etc…I suppose the code would have to reconstruct the dupliacted MC’s ???

Can you help Ahmed…as you can see your scribble app does 90% of what I am trying to achieve but I need to drag and drop MC instances instead of draw a picture.

Here is the flash file zipped :

Hm… I think your best bet would be to do that on a tile-based world, and store the array with the objects in a sharedObjecy. XML is an extra. I’ll be back in a few minutes with more information =)

Tile based world…I like the sound of that, don’t know what it is but I am sure you will explain later.

The reason I thought of using XML is just another way to store the meta data ie data on the MC’s instances etc but does not have to be XML…shared object would be better is for the local machine which is good for now.

Eventually will want to give the user the option of saving the snap shot on a web server…I guess if we can get the snap shot/ reconstruction (Save/Load) working then saving arrays etc to a text file or something on a web server will be easy.

I am going for a run will be back in 30mins or so…look forward to your reply. :beam:

Ok, here’s how i would usually do it.

I would create 1 movieclip with 3 frames in it, the first one with the ‘computer’ symbol in it, the second with the ‘group’ symbol in it, and a third one with the ‘person’ symbol in it. I would keep that in the library and give an idName of “component”.

A tile-based world can be taken as a chess board-type of thing.
That chess board can be represented by a two-dimensional array. A two-dimensional array looks like this:

// represents a 9x9 board
myArray= [ 
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0]
]

So when, let’s say, a ‘computer’ symbol is dropped within a certain block, we round the _x and _y of that clip and divide them by the size of the block, ending up with a pair of coordinates, something like (5, 8). To get those values, you would do something similar to this:

var x = Math.round(clip._x/blockSize);
var y = Math.round(clip._y/blockSize);

We then give myArray[8**][5] a value of 1, indicating a computer symbol… We would repeat that everytime a symbol is dropped on stage.

The last step would be to create a ‘render’ function. What this function does is basically fetch the array ‘myArray’ and look up the value of each entry (through nested for-loops). If it’s 1, it attaches the movieclip ‘component’ and goestoAndStops at frame 1. If two, it stops at frame 2.

After all that is done, you can save data in a sharedobject to store it locally, or create an XML file and store it in the database to store it on the web =)

I didn’t give you any code as you can see, but rather the idea behind a project like the one you’re working on. Hope this gets you on the right. I still wouldn’t mind helping you with the code, just let me know if you need any help with it =)

****** edit ******

Actually, I decided to make a sample FLA… working on it =)

You ARE definitely the guy to talk to !!!..I think I understand the chess board 2 dim array concept, just not 100% sure.

When the computer for instance is dragged onto the stage it can be moved around freely again and again (like in currentone.fla), yes ???..the computer does not snap to one of the virtual squares like moving a piece on a chess board ?..needs to be free to move.

Oh…one thing I forgot to mention the object eg computer should not be allowed to be dropped unless it is within the stage boundary (Just like the pen in Scribble…)

I really apprecaite your help with the project…please feel free to rewrite the app…As you probably guessed I am not a software developer…just a novice learning in my own spare time…I will try real hard to keep up.

:thumb:

hm… if you don’t want a snap-to-grid-kind effect, then we wouldn’t exactly use a tile-based approach. The only effecient way I see would involve object-oriented programming, which i doubt you’re into.

I’ll be back in a few hours with a sample file of what i’m talking about =)

(it’s 7:15 am EST and I haven’t been to bed yet… need to sleep =))

Okay let me think about this one talking though the keyboard doesn’t always get all the messages across…I think the nearest to the concept is microsoft visio where you have shapes that can be created moved around or deleted (Scaling - not needed here at the mo)…you can then draw a connector line between objects or delete it if necessary.

If we have to use a snap grid type system then that’s okay the squares would have to been smaller giving that bit more accuracy when first drag and drop of the “Components” and subsequent moving around or deletion.

You have not been to bed yet ?? no way !!!..get some sleep and we will talk again soon.

Bye for now…

:thumb:

hehe sure… with a snap-to-grid effect i think it’s gonna be easier to create. The lines and all are also doable :slight_smile:

ahmed.swapDepths(bed)

I really am coming round to your concept of an invisible checker board/ grid…I can see now how it would work…to get more accuracy and less snap movement I would imagine smaller squares would be used.

Will the symbols eg compter, person, people (and others to come)…have the same physical dimensions as the individual square in which it is being snapped into? or can we just have the centre of the symbol snapping to the centre of the individual invisible square/ grid leaving the symbol dimensions free to be whatever ? I think the second option would be better but it might interfere with the connector arrows later on…not sure right now…will have to see what develops…:beam:

Hope you dont feel like this :hangover: need to recharge your :battery:

Just got back from Quad biking whilst doing so I performed a ripping 5ft air jump and came off and badly sprained my ankle…bike drove over my leg…feel like :hangover: won’t be checking our thread until Sunday…will catch up with you then…thanks for your help so far. :beam:

Ahmed were you thinking along the lines of:

http://www.kirupaforum.com/forums/showthread.php?s=&threadid=26293&highlight=isometric

But snapto2d not snaptoiso ? :slight_smile:

I know it sounds wierd but can you see what we are trying to achieve working in isometric perspective ?

May best to prove the concept in 2d first…8]

Off the subject a bit I know but I thought this was pretty neat…http://www.flashcomponents.com/details.php?table=ff&id=400&link=

:thumb:

**Ahmed Congrats…**on being promoted to forum god like status…I suppose now with your new Bruce Almighty type powers you will be tied up with monitoring the forum and not get a lot of time to help with coding ? :frowning:

haha, thanks… being a mod makes helping other’s more of a duty :beam:

I’m working on some functions for you to go along with a sample FLA =)

Good on ya mate…will wait for your next post…:thumb: