A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: How can this be Done?

  1. #1
    Junior Member
    Join Date
    Mar 2010
    Posts
    2

    How can this be Done?

    Hi,

    I want to make a jewelry script in flash. The script will work some thing like this, a user selects a shape and then presses next, then he sees all the design patterns he can apply to the shape, he can drag and drop design patters.

    After he is satisfied he can email this to some one as an email.

    It is my project so a help will be appreciated or you can guide towards a solution. Please do not refer to some place to buy as i must complete it myself as thats the way i will be able to explain it.

    Kind Regards

  2. #2
    Senior Member
    Join Date
    Jan 2010
    Location
    England
    Posts
    268
    cant help you with the email bit and selecting a shape is easy enough im sure you can do that no problem.


    from the sound of it youll want to have different objects and dragable movieclips that will attach a movieclip onto that object.

    make some movieclips and put them at the bottom.
    then on your jewlry shape actions type:
    Code:
    onClipEvent (enterFrame) {
    	if (_root.mc.hitTest(_root.jewlry)) {
    		this.attachMovie("pattern","pattern1",this.getNextHighestDepth(),{_x:jewlry, _y:jewlry});
    		_root.mc._visible = false;
    	}
    }
    line1: will perform this everyframe
    line2:if your dragable mc with the instance name of "mc" hits your object with the name of jewlry it will
    line3:attach the movieclip "pattern" (make sure you set that up in linkage) from your library and give it an instance name of pattern1
    line4:getnexthighestdepth will place it on the next highest "layer" or in otherwords ontop of your object
    & will only attach onto the object and nowhere else
    line6:your dragable mc will become invisible

    have a pattern to attach to your jewlry ready. then in the library right click it and choose linkage and select "export for actionscript" make note of the identifier as thats what youl be using to refer to it.

    thats all well an good but u want to drag the mc into the jewlry object.
    your hitTest is setup so now you can use this on your main timeline:
    Code:
    pattern.onPress = function () {
    	this.startDrag(true)
    }
    pattern.onRelease = function () {
    	this.stopDrag(true)
    }
    this is saying that when you press the mouse button on the pattern you want you can start dragging it, when you release the mouse button you will stop dragging it.

    to smoothen the dragging of the pattern mc use this:
    Code:
    onMouseMove  = function(){
    updateAfterEvent();

    there you have it. you should now be able to drag a movieclip pattern onto your shape and have the pattern be layed ontop of the shape. to help you further iv attached a demo .fla of this working. now just use your imagination and make those patterns and jewelery i guess you'l have to change bits around of course.

    and a note:robb@exo here on flashkit helped me out with a getnexthighestdepth problem i had a while back and its because of him i understand how it works now
    Attached Files Attached Files
    Last edited by stevehungry; 03-14-2010 at 11:39 AM.

  3. #3
    Junior Member
    Join Date
    Mar 2010
    Posts
    2
    Thanks for such a detailed reply. It really helped!

  4. #4
    Junior Member
    Join Date
    Sep 2010
    Posts
    1
    Hi Steve,

    I've been using your fla for testing purpose but i'm wondering if u could use images instead of checkbut and stripebut? Cause if i replace them for images (jpg convert to mc) the swf won't work.

    Thanx in advanced

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center