Results 1 to 6 of 6

Thread: Drag and Drop to grid with Snap to and Text Handles

  1. #1

    Drag and Drop to grid with Snap to and Text Handles

    Hi Everybody,

    I'm tackling a new project and I can't figure out where to start! The app allows the user to drag images from a libray onto a grid and position the elements within the grid. The user can also drag textfields which can be edited and resized.

    The grid needs to have some sort of snap-to, to make it easier for the user to line up the elements. And then I need to create resize handles around both the editable text fields and the other mc's. Has anyone seen a tutorial or can anyone help me with?

    1. Drag and drop with a snap to grid
    2. Resize handles for mc's, and inparticular textfields

    In the end, I need to be able to track all of the x and y's of the elements on stage and then be able to rebuild their layout when it is loaded in a subsequent session. I'm sure this is going to be difficult. What do you think?

    Brook

  2. #2
    For the snapping - if you know the size of a grid-shell you can use rounding to find the nearest matching value

  3. #3
    I will know the size of the grid, but I don't know how to do this. Can you show me an example?

    Quote Originally Posted by v2ikematu
    For the snapping - if you know the size of a grid-shell you can use rounding to find the nearest matching value

  4. #4
    Code:
    mc_mc.onPress = function() {
    	this.onMouseMove = function() {
    		grid == 0 ? grid=1 : grid>40 ? grid=40 : null;
               /*this line (^) is there becouse we cant divide by 0
               and i didnt want the grid to be bigger than 40*/
    		this._x = Math.round(_root._xmouse/_root.grid)*_root.grid;
    		this._y = Math.round(_root._ymouse/_root.grid)*_root.grid;
    	};
    };
    mc_mc.onMouseUp = function() {
    	delete this.onMouseMove;
    };
    Attached Files Attached Files
    My real name is: Cristián Arenas Ulloa.

    Member #1 Of The NiñoScript's Club
    Member #4 Of The I Want A Mac Club
    Member #7 Of The Kirupa Anime Club
    Member #1 Of The Courier Font Club

  5. #5
    Sweet. thank you very much, I will try this!

  6. #6

    grid.swf need source

    Hi,
    can u plz. share grid.swf source file.
    Thanks
    Vijay
    Quote Originally Posted by NiñoScript View Post
    Code:
    mc_mc.onPress = function() {
        this.onMouseMove = function() {
            grid == 0 ? grid=1 : grid>40 ? grid=40 : null;
               /*this line (^) is there becouse we cant divide by 0
               and i didnt want the grid to be bigger than 40*/
            this._x = Math.round(_root._xmouse/_root.grid)*_root.grid;
            this._y = Math.round(_root._ymouse/_root.grid)*_root.grid;
        };
    };
    mc_mc.onMouseUp = function() {
        delete this.onMouseMove;
    };

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012