How would I make a draggable pop-up box?

  • Jack Sparrow
  • Beginner
  • Beginner
  • Jack Sparrow
  • Posts: 36

Post 3+ Months Ago

Hi, I'm looking into new ideas and stuff for making my website better, and I have come across an idea that I would like to incorporate into my site.
It's basically a box with a scroll bar that appears, and it is able to dragged anywhere within your flash movie.

If you would like to see an example of what I'm talking about, then go to this site. http://www.perfectory.com/portfolio.htm Click on 'Product', select 'Flash Templates' and click Search. It's on page 7, and the 8th from the top left. Click on and when it comes up, click on 'Read Details' within the template to see what I'm reffering to.

If anyone would be able to give any idea how I would build something like this, even just a general idea, that would be great.

Thank you.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • classified
  • Expert
  • Expert
  • User avatar
  • Posts: 540
  • Loc: Bahrain

Post 3+ Months Ago

u will first need to build up your Draggable MovieClip and export it for run time ...

using attachMovie u can make it pop in ...

then use startDrag() to drag it arround ...

http://www.thecodebehind.com/code/dragg ... flash.aspx


now when you actually build the fla , tell us where r u stuck at , then we'll help ya ..
  • Jack Sparrow
  • Beginner
  • Beginner
  • Jack Sparrow
  • Posts: 36

Post 3+ Months Ago

classified wrote:
u will first need to build up your Draggable MovieClip and export it for run time ...

using attachMovie u can make it pop in ...

then use startDrag() to drag it arround ...

http://www.thecodebehind.com/code/dragg ... flash.aspx


now when you actually build the fla , tell us where r u stuck at , then we'll help ya ..


I've got my movie ready, and it has my scrollbar in it. I'm just confused about what you mean by attachMovie, do you mean I need to start a new flash movie and asign that action in there, to bring in my swf, or how would it work.
Also, I'm still learning actionscript, so you'll need to bear with me. I'm not sure how attachMovie will work.

What I want to do is have a button on a movie, and when that button is clicked I would like my scrollbar movie to be loaded in, and to have it be draggable so that I can place it anywhere I like within the movie. I'm just not sure how it will work with the scrollbar, because I would need only the top part of the movie to be draggable so that the scrolling function would still work.
  • classified
  • Expert
  • Expert
  • User avatar
  • Posts: 540
  • Loc: Bahrain

Post 3+ Months Ago

say you have a button that will bring the popup yeah ?

now remember , you have the popup movieclip in your library so you need to give it an identifier ..
open the library , right click your MovieClip and click on Linkage > tick the export for actionscript > under Identifier give it the name popUp . click ok .

to load your movie , you will need an empty movieclip ..
Code: [ Select ]
_root.createEmptyMovieCLip("container",_root.getNextHighestDepth() );

now set the X and Y coordinates for the new MovieClip ...

Code: [ Select ]
container._x = 200;
container._y = 200;
  1. container._x = 200;
  2. container._y = 200;


now time to weite the function for the button ...

Code: [ Select ]
button.onRelease = function() {

    container.attachMovie(popUp , "pop" ,this.getNextHighestDepth());
}
  1. button.onRelease = function() {
  2.     container.attachMovie(popUp , "pop" ,this.getNextHighestDepth());
  3. }


that is container.attachMovie(LinkageName , new Name , Depth) ;

i think this is it ...
  • Jack Sparrow
  • Beginner
  • Beginner
  • Jack Sparrow
  • Posts: 36

Post 3+ Months Ago

classified wrote:
say you have a button that will bring the popup yeah ?

now remember , you have the popup movieclip in your library so you need to give it an identifier ..
open the library , right click your MovieClip and click on Linkage > tick the export for actionscript > under Identifier give it the name popUp . click ok .

to load your movie , you will need an empty movieclip ..
Code: [ Select ]
_root.createEmptyMovieCLip("container",_root.getNextHighestDepth() );

now set the X and Y coordinates for the new MovieClip ...

Code: [ Select ]
container._x = 200;
container._y = 200;
  1. container._x = 200;
  2. container._y = 200;


now time to weite the function for the button ...

Code: [ Select ]
button.onRelease = function() {

    container.attachMovie(popUp , "pop" ,this.getNextHighestDepth());
}
  1. button.onRelease = function() {
  2.     container.attachMovie(popUp , "pop" ,this.getNextHighestDepth());
  3. }


that is container.attachMovie(LinkageName , new Name , Depth) ;

i think this is it ...


I've done everything you'se said, but when I click the button nothing happens. I'll keep checking though to see if there is something I've done wrong.
  • classified
  • Expert
  • Expert
  • User avatar
  • Posts: 540
  • Loc: Bahrain

Post 3+ Months Ago

i'll do ya an example ...
i might have somethin wronge as well ... :D lol ...
  • classified
  • Expert
  • Expert
  • User avatar
  • Posts: 540
  • Loc: Bahrain

Post 3+ Months Ago

ahhh
see where its says .._root.createEmptyMovieCLip
change it to _root.createEmptyMovieClip

had capital L in the CLip ... it should be clip ...

anyhow attached file

http://www.zainals.com/loads/attachMovie.fla

that is a flash 8 files hope u got 8 , if u have mx let me know so i save as MX ..
  • Jack Sparrow
  • Beginner
  • Beginner
  • Jack Sparrow
  • Posts: 36

Post 3+ Months Ago

OK, I've got my movie coming in now, but now I'm not sure where I add the script in to add a draggable bar.

Also, is there anyway to close my movie after I've opened it, like having an X at the top corner of the movie so I can close it.
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

sure, sure
make a button or a movieclip with an X, name it btnClose, then:
btnClose.onPress = function()
{
movieToClose._visible = false;
}
  • classified
  • Expert
  • Expert
  • User avatar
  • Posts: 540
  • Loc: Bahrain

Post 3+ Months Ago

http://www.zainals.com/loads/drag_close.fla

the red button for dragging , the X to close ... check the actionscript included ...
u can always make the button invisible ...
  • Jack Sparrow
  • Beginner
  • Beginner
  • Jack Sparrow
  • Posts: 36

Post 3+ Months Ago

classified wrote:
http://www.zainals.com/loads/drag_close.fla

the red button for dragging , the X to close ... check the actionscript included ...
u can always make the button invisible ...


Thats great, thankyou. Thats what I was looking for. The only thing I will need now is a button that loads it in after you close it. I'll try to get that working.
  • classified
  • Expert
  • Expert
  • User avatar
  • Posts: 540
  • Loc: Bahrain

Post 3+ Months Ago

button would be this ..

button.onRelease = function() {

container.attachMovie(popUp , "pop" ,this.getNextHighestDepth());

}

just like i have showed ya earlier ..

anytime buddy ..

Post Information

  • Total Posts in this topic: 12 posts
  • Users browsing this forum: No registered users and 13 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.