1 Attachment(s)
Create-than drag and drop at fixed location
Hello there. I am quite new working with Flash. I have Flash Macromedia Professional 8 and I'd like to create something involving the drag and drop to snapping targets using a model I've find it very useful.
I have only one problem: The example has only one button that spawn a single type of item. I'l like to have 2 more buttons that spawn another two different items. So I have made another 2 more buttons named ("Create Item 2" & "Create Item 3") at the bottom of the screen, and here is the problem: I don't know how to make them to create a different item every time each of them is pressed. I've tried several times modifying the main script but it appears I'm missing something important. In other words, I would like the script to be like this: When button "Create Item" is pressed, it generates an infinite number of "Item1" which can be dragged and snapped in the inventory; When "Create Item2" is pressed, it generates an infinite number of stickable "Item2" and the same with the third button, it creates a different Item to show up and dragged to the desired targets.
If you really want to tell me how to do it, it would be great. I didn't count how much time I've spent to find an answer to this problem and I looked over the entire WWW to find a solution and simply there is not! I believe this is not something impossible to achieve, I mean....since it works to generate an item, this should work (at least theoretically) for an infinite number of other "Library" items.
Once again, if any of you could give me a hint or advice to point me in the right direction, I would be sincerely greatful. Thank you all for your time.
PS: I have attached the FLA file in case someone wants to take a look over my problem.
close tile btn, delay effect or loading jpg's from an external source
Hello again,
Now, I have my prodject finished by 100%. Although I still have 3 minor questions that I would like to ask (and although they may not be answered due to the high difficulty level involved), I still consider the prodject done.
1) Before having the option to turn the tiles into an endless spawning mode, in my old prodject, I ended up with ~ 200 tiles, each one draggable as a stad alone, but using a different action script, of course. There, I managed to insert little individual "tweeks" that worked so well along with that type of script. And I'm referring that each draggable tile was a movie script and had an option (a small "X" button attached to it), to close that tile at need.
Eg: "function dragSetup(clip, targArray) {
clip.onPress = function() {
startDrag(this);
if (this.closeMC.hitTest(_xmouse, _ymouse, true)) {
this._visible = false;
}"
2) Also, the tile/s was forced to stick/return to their origins with some kind of "delay" effect which was pretty cool and now, I miss it somehow.
Eg: "// then move the MC back to its original starting point (with a smooth motion)"
if (!this.beingDragged && !this.onTarget) {
this._x -= (this._x-this.myHomeX)/5;
this._y -= (this._y-this.myHomeY)/5;"
But the more important was the close tile button.
Now, after a few attempts working with this new script, and some searches over the WWW, I have found out that I cannot add a close button to an already existent button, UNLESS I use some sort of trick, like this: over the main image, place a transparent button, than the close button goes on top of those two and in the final, select the all layers and made them a movie clip, etc. etc.
After a few attempts I simply gave up, because with this script, the button (which was supposed to close the tile) was treated like a draggable thing too, and couldn't stand on top and doing it's closing function.
3) The third problem is more like a personal wish. In this prodject I have 20 movie clips and I use them as backgrounds with a simple command like this:
Eg: "vis();
function vis(){
_root.background0._visible=true;
_root.background1._visible=false;
_root.background2._visible=false;
----------------------------------
_root.background20._visible=false;
}"
All is working fine in testing mode, but after I save the file and testing it in a browser, not only it's a waaaaay to large, but due to this it's get laggy, too.
So, I decided to look for another trick to solve this.
All I want is to make each of the 20 backgrounds "gostly" somehow (without weight) and keeping their actual position unchanged, to add/alter the code of the script in some way, when someone press for example the button nr. 7-to show bg. nr. 7, but the image that was initially taken from the main file itself, this time to be taken from the hosting server or from a collection of these bgs. I have on another hosting place.
I am almost sure this can be achieved and I have found a script related to this:
Eg: "background0.onRelease = function(){
getURL("http://www.my place.com/........");
}"
If you are more familiar than me with this, maybe you can give me a little helpful hand, keeping in mind that I would like to preserve the actual position of the backgrounds, reducing them to almost "no weight", and on press (internet connection recquired), to show up from anywhere else, except from my flash file.
I will be very pleased if someone will take a look over these and give me a glimpse or some sort of advice how to proceed or at least to tell which one is/may be achievable and which one is not.
The prodject is ready without these, but if I can work around the solution, it would be a great addition to the file. I repeat, these little concernings are not a must and it's not a great, great loss if I don't include them.
Anyway, thank you in advance for reading this message.
3 Attachment(s)
drag, drop, snap and close
Ok, are you still there? :confused:
Here we go...take a look (sorry it took so long my response).
1) Basically, what I try to achieve, is adding a close button over my spawning tiles. I have found a demo which apparently works, but not on a spawning....things. I have tried it, but I didn't achieve the desired results. I have inserted the original demo, too.
Beside this, I have attached the other 2 files, the first one with my closing method (but without spawning mode), and the other one with the new script (in which you have helped me so much).
2) The other issue, is on the background images. I have so many, that "eats" a lot of space after I save the final prodject. I would like to find a method, which empty-es the content of the bg's, and adding in the button script some sort of code who lead the action to a hosting place (outside of the file) from where the image loads itself, right in the place I put it in the prodject.
3) The third one, is the least important, it adds a silky and cute delay at the moving tiles which makes them out of ordinary.
Many, many, many thanks!!!