Putting A Layer Over Drawing Canvas - Tile Map

I want to make it so that a layer will be above the map when its drawn.
Like I want a layer over this, cause im making a menu for the game, but the game is above the layer.
var tiles:Object = new Object({width:52, height:26}); // The size of the 'flat' tile. Tiles are allowed to be different dimentions, to give the '3D' effect.
var offset:Object = new Object({x:130, y:100}); // This object helps center the 'hero' to the stage.
var hero:Object = new Object({x:1, y:5}); // The starting position of the 'hero'
var canvas:Object = new Object({mc:_root.createEmptyMovieClip("canvas", _root.getNextHighestDepth())}); // Contains the primary movie clip and map information.
canvas.map = new Array( // Dictates the topography of the environment
                        // The reason I decided to to use 200 for walls and 100 for ground is to leave
                        // the option open add more tiles, such as 86 for another type of tile that is
                        // walkable. Since the collision detection code checks to see if the tile is
                        // less then 200 (less is walkable, 200 or above is not), there is no need to change
                        // the code toenable new tiles, simply name them a number between 0 and 200.
                        new Array(200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200),
                        new Array(200,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,200),
                        new Array(200,100,100,100,100,100,100,100,100,100,100,100,193,196,196,196,196,189,100,200),
                        new Array(200,100,100,100,100,100,100,100,100,100,100,100,194,187,182,182,179,190,100,200),
                        new Array(200,100,100,199,199,199,199,199,199,199,199,199,199,186,183,183,180,190,100,200),
                        new Array(201,199,199,199,100,100,100,100,100,100,100,100,194,186,183,183,180,190,100,200),
                        new Array(200,100,100,100,100,100,100,100,100,100,100,100,194,186,183,183,180,190,100,200),
                        new Array(200,100,100,100,100,100,100,100,100,100,100,100,194,186,183,183,180,190,100,200),
                        new Array(200,100,100,100,100,100,100,100,100,100,100,100,194,185,181,181,178,190,100,200),
                        new Array(200,100,100,100,100,100,100,100,100,100,100,100,192,195,195,195,195,188,100,200),
                        new Array(200,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,200),
                        new Array(200,100,100,100,100,100,200,200,200,200,200,200,200,200,200,200,200,200,200,200),
                        new Array(200,200,200,200,200,200,200)
_root.onLoad = function():Void
    initmap(canvas.map); // Draw the map
    initplayer(); // Draw the player
    return;
_root.onEnterFrame = function():Void
    input(); // Handle keyboard movement
    return;
function input():Void // Modifies the 'hero' object, handles collision detection ('hero' and wall)
    // Any tile less then 200 is walkable, anything above is not.
    // No need to change this code handle more tiles, just name the tiles a number.
    // (not the best way to do this but simple, quick, and easy to do)
    if(Key.isDown(Key.LEFT) && canvas.map[hero.y - 1][hero.x] < 200) hero.y--;
    else if(Key.isDown(Key.RIGHT) && canvas.map[hero.y + 1][hero.x] < 200) hero.y++;
    else if(Key.isDown(Key.UP) && canvas.map[hero.y][hero.x - 1] < 200) hero.x--;
    else if(Key.isDown(Key.DOWN) && canvas.map[hero.y][hero.x + 1] < 200) hero.x++;
    move();
    return;
function move():Void // Moves the background and the hero
    // These three lines handle swapping the tile depths to give the '3D' effect
    var d:Number = (hero.y * tiles.height) + (hero.x * tiles.width) + hero.y;
    hero.mc.swapDepths(d);
    canvas.mc["tile_" + hero.y + "_" + hero.x].swapDepths(d - 1);
    // Move the hero in the opposite direction the environment moves
    hero.mc._x = (tiles.width / 2) * (hero.y - hero.x) + offset.x;
    hero.mc._y = (tiles.height / 2) * (hero.y + hero.x) + offset.y;
    // Move the environment
    canvas.mc._x = (tiles.width / 2) * (-hero.y - -hero.x) + offset.x;
    canvas.mc._y = (tiles.height / 2) * (-hero.y + -hero.x) + offset.y;
    return;
function initplayer():Void // Self-expalanatory
    var d:Number = (hero.y * tiles.height) + (hero.x * tiles.width) + hero.y;
    hero.mc = canvas.mc.attachMovie("hero", "hero_mc", d + 1, {_x:hero.x * tiles.width, _y:hero.y * tiles.height});
    move();
    return;
function initmap(map:Array):Void // Render map
    var map_height:Number = map.length; // Determine height of the map
    var map_width:Number = map[0].length; // Determine width of the map
    for(var y = 0; y < map_height; y++)
        for(var x = 0; x < map_width; x++)
            // Movieclip depth is everything when doing an isometric game
            var depth:Number = (y * tiles.height) + (x * tiles.width) + y;
            // Attach tile to 'canvas'
            var tile:MovieClip = canvas.mc.attachMovie("tile" + map[y][x], "tile_" + y + "_" + x, depth);
            tile._x = (tiles.width / 2) * (y - x) + offset.x;
            tile._y = (tiles.height / 2) * (y + x) + offset.y;
    return;

there are no layers when your fla is published (or tested).  all displayobjects are assigned depths based on code used to assign depths and compiler code that assigns depths to objects you place on-stage in the authoring environment.
all objects placed on-stage in the authoring environment are placed at negative depths starting with about -16,380.   that's why your menu (which is probably added to some layer in the authoring environment is below the movieclip you placed at nextHighestDepth() (which adds to no depth less than zero)
to change a movieclip's depth use the swapDepths() method of movieclips.

Similar Messages

  • Can I add Any Layer on drawing canvas  ? if yes, How  ?

    Hi,
    I am developing a paint application in java JApplet. And I am drawing something like rectangle, free hand, oval, circle on canvas. I want to add Layer, which gives me seperate layer to work without erasing previous. I just read about LayeredPane and GlassPane. Which is suitable for using drawing. If it is layeredPane. then please tell me how to add single layer at single action performing like when I want to press pencil button then the layer will add. And when i want to press rectangle then second layer will add. And if it is GlassPane then how can i use it. I have used Glasspane. It making all buttons disabled. I just want to use it within drawing canvas. Please help me.....
    Thanks in advance
    Manveer

    Hello,
    I have read all documentation of JLayeredPane. Now I want to use it. Firstly I want to tell you that I have used a separate private class that is extending Panel. Then I have used double buffering for drawing anything on it. And after this I have added this class on JApplet by using getContentPane(). Can i add this canvas as layer, which contains images or drawing. Now what i want that When i have draw some thing on drawing canvas. And again want to draw something on canvas. at that time the canvas will add a layer which is a panel with setOpaque(false). which is totally transparent. And after set layer on canvas. the previous drawing remain same not be wash out or lost. And I can see the previous drawing after set layer. Please tell me how to do this. If you have any simple example or any advice for doing right thing. please tell me or send me.

  • Help. cant put a second layer over another without the picture breaking up

    Just started happening.  On a PC, have plenty of Ram.  NVIDIA card.  Was working fine, but now whenever I put one video over another the second picture starts breaking up.  If I delete thelayer below, the picture is fine again. Any ideas

    I will check tomorrow, but it's possible they are different.  Has that been known to be an issue?

  • What's so good about tile maps?

    I've been testing a 2d platform game I'm working on (for a bit of a laugh), and I was about to start working of some sort of tile map system for the scrolling backgrounds, and I though 'what the hey, rather than use a tile map I could just draw the whole level as one big gif', or maybe break it down to 5/8 images or something.
    Fullscreen bufferStrategy can easily handle all the unnecessary off-screen drawings and I'm not relying on image data for collisions as all collisions are done with bounding boxes (I'll eventually only be testing the onscreen bounding boxes, so there's a small saving :)
    I done a test with the player checking for 2000 (way OTT) collisions per game loop, and drawing 2 huge scrolling images (one a transparent gif the other solid, and it didn't drop a frame). Also this way there are no restrictions to the detail I can put in the background and anyone will easily be able to draw there own image and load it into the editor (when its finished) and click in a few platforms/badguys and stuff very easily.
    The background image size will probably end up about 233k per level. The screen rez will be 320/240 for that chunky pixel look.
    Am I being lazy :)

    John Carmack once described tile-based systems as, essentially, a really poor compression scheme.
    Compression aside, there is value in tile-based systems.
    You can create many, many maps (and let your users make their own) with little trouble with a map editor and a tile set. The reason Baldur's Gate, Baldur's Gate II, Icewind Dale and Icewind Dale II were so painful to make for the artists was that each map had to be hand drawn - all of it. Neverwinter Nights uses 3D tilesets, resulting in easy development, even for unskilled (in terms of art) hobbyists.

  • Is it possible to create a 'layer' over the top of a PDF in Captivate?

    I am trying to integrate a 3dpdf within captivate 8 for a software training program, for this it is important to retain functionality to the pdf menu, Captivate handles this well : ) HOWEVER on importing the pdf it becomes clear that the pdf 'trumps' other objects such as clickable areas or text, which therefore don't seem to appear when published. I also wish to provide 'blocked' areas by putting transparent objects over the top of the pdf so as to control the learning process, which also doesn't seem possible on initial inspection.
    Does the PDF exist outside the timeline?
    Does anyone know how to layer objects over a pdf object that will remain there when published?
    Many thanks!
    Sam the Giraffe

    How/where do you want to accomplish it?
    Within the document? Using Acrobat? Using another application?
    Using Acrobat within the document would be possible using Acrobat JavaScript. You can access the annotation objects of your document, and you then can evaluate the properties of each of these objects. Have a closer look at the Annotation Object section in the Acrobat JavaScript documentation.
    You will look for the contents property, and evaluate its content. When you have found something looking like a URL, you can create a link (using the rect property of the annotation), and you have what you want; you might then think to destroy the annotation, as it may overlay the link.
    Hope this can help.
    Max Wyss.

  • Transparent layer over something opaque

    Hi I'm trying to put an image over a webcam video. Is it possible to put a transparent layer over the video so it makes the video form into a shape.
    Like here's the webcam ->
    |                    |  
    |                    |
    Can I put a image layer over it that is transparent, that will show the background through? Like this ->
    |              |___ <- this is an image layered over the webcam with the background visible.
    |                    |
    Thanks if anyone can lend me a hand.

    Hi...
    Looks like we are trying to do the same thing - unfortunately we don't know much about coding, so we don't quit understand what to do.
    we would like to place an image on top of the webcamera
    so that the image of whats is being recorded is behind this image.
    is it possible?

  • How do I create an infinite drawing canvas in a ScrollPane?

    I wanted to figure this out on my own, but it is time to ask for help. I've tried too many different things. The closest I've come to the behaviour I want is with this code:
    final BorderPane root = new BorderPane();
    final Pane canvasWrapper = new Pane();
    canvasWrapper.setPrefSize(800, 500);
    canvasWrapper.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    canvasWrapper.setStyle("-fx-background-color: lightgray; -fx-border-color: green; -fx-border-width: 2px;");
    final Group canvas = new Group();
    canvasWrapper.getChildren().add(canvas);
    final ScrollPane scroll = new ScrollPane();
    scroll.setContent(canvasWrapper);
    root.setCenter(scroll);
    // event code for adding circles and lines to the canvas
    I want the ScrollPane to be filled with the Pane, so it can catch events for drawing. When the stage is resized, the ScrollPane is resized too. This the result of the BorderPane. What I want is to expand the window and have canvasWrapper expand to fill the entire ScrollPane viewport. When the stage is made smaller the ScrollPane shrinks, but I want the canvasWrapper to retain its size. The idea is the drawing canvas can only grow. When it gets too large for the current stage/ScrollPane size, the scrollpane can be used to navigate around the canvas.
    I tried using
    scroll.setFitToHeight(true);
    scroll.setFitToWidth(true);
    but this causes the Pane to be made smaller when the viewport is made smaller.

    I figured it out!
    Use
    scroll.setFitToHeight(true);
    scroll.setFitToWidth(true);
    to resize the Pane as the view port changes.
    Save the canvas' size as the Pane's size.
    canvas.layoutBoundsProperty().addListener(new ChangeListener<Bounds>() {
                @Override
                public void changed(ObservableValue<? extends Bounds> ov, Bounds t, Bounds t1) {
                    canvasWrapper.setMinSize(t1.getMaxX(), t1.getMaxY());
    This forces the Pane to always be as large as the group is.
    Missed a piece of code - jrguenther

  • Manually added tracks put my iPhone over capacity. Now I can't sync. Help!

    I have a number of Audiobook I tried to sync to my phone.  I could not find anywhere in the iPhone settings to choose to sync these (anyone know where?).  So I manually added them by dragging them from iTunes onto the iPhone. 
    However they are very large files and put my iPhone "over capacity".  Now whenever I try to sync I get an error message saying:
    "The iPhone “Mr Shiney” cannot be synced because there is not enough free space to hold all of the selected items (additional 7.38 GB required)."
    But I can't unselect these files!  They don't appear in the "Manually Added Songs" section of the Music tab.  My phone is stuck in this weird state where I can no longer sync.
    I have tried deleting the songs from iTunes.  But this now just says the songs couldn't be found so I still can't sync.
    Should I restore from backup?  Won't I lose all my app content?  Any ideas what to do?
    My iPhone is a 3G on iOS 4.2.1. iTunes is 10.5.

    Have you touched the "More" button (on the iPhone).
    then gone to Audio Books.
    Are they there?
    I had an audio book still on my iphone, it survivedf the iOS5 update.
    To get rid of it, I plugged iPhone into Mac,
    Go to itunes.
    Click on Iphone in iTunes.
    Go to Books tab,
    Scroll down, there is audio books.
    Choose sync selected audio books,
    And untick the ones I don;t want.
    Dows this work for you?

  • Adding a text layer over a sliced PS image

    Having trouble positioning a text layer over a PS sliced
    image.
    The sliced image is positioned relative to the center of the
    page (so it appears in the same place regardless of monitor size or
    resolution, and that's where I want it).
    I can position the layer in Dreamweaver, but when previewed
    in the browser, the test layer moves to the left -- apparently
    being positioned relative to the left side of the screen.
    Is there any way to position a text layer so that it is
    position relative to the center of the page (and therefore reliably
    will appear on top of an image also positioned relative to the
    center of the page)?
    Any suggestions?

    This is a bad approach. Consider what will happen to your
    careful alignment
    if someone resizes their text in their browser. If you must
    place text over
    an image, the best way to do it is to make the image the
    background of some
    container, and then use CSS (margins or padding) to nudge the
    text into the
    desired location location. You will still have the same
    problem, though.
    > I can position the layer in Dreamweaver, but when
    previewed in the
    > browser,
    > the test layer moves to the left -- apparently being
    positioned relative
    > to the
    > left side of the screen.
    That's how absolutely positioned elements work when they are
    not within some
    other positioned element. The zero coordinates default to the
    <body> tag,
    i.e., the upper, left-hand corner of the browser viewport.
    > Is there any way to position a text layer so that it is
    position relative
    > to
    > the center of the page (and therefore reliably will
    appear on top of an
    > image
    > also positioned relative to the center of the page)?
    Certainly, but you will have to understand CSS positioning to
    accomplish it.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "Phyto-Man" <[email protected]> wrote in
    message
    news:[email protected]...
    > Having trouble positioning a text layer over a PS sliced
    image.
    >
    > The sliced image is positioned relative to the center of
    the page (so it
    > appears in the same place regardless of monitor size or
    resolution, and
    > that's
    > where I want it).
    >
    > I can position the layer in Dreamweaver, but when
    previewed in the
    > browser,
    > the test layer moves to the left -- apparently being
    positioned relative
    > to the
    > left side of the screen.
    >
    > Is there any way to position a text layer so that it is
    position relative
    > to
    > the center of the page (and therefore reliably will
    appear on top of an
    > image
    > also positioned relative to the center of the page)?
    >
    > Any suggestions?
    >

  • How do I put a title over a photo?

    I've seen a lot of posts about putting a title over a video clip, but what I want to do is put a title over a photo. I am able to insert titles just fine and same thing with just photos, but I can't seem to combine them. When I try to drag one on top of the other, it moves to the left or right and creates two seperate things. I have made sure that the length and duration of each is the same and also that I leave the "Over Black" box unchecked. Any suggestions?

    What do you mean by it 'creates two separate things'? In iMovie 5, I don't think there was an 'add' button. You have to drag the title 'T' box down to the photo in the timeline. IF you are having problems wiht this, try deleting the iMovie plist and the reopen iMovie and try again. (The plist is in YourUserName->Library->Preferences->com.apple.iMovieplist. Trash that and relaunch iMovie.
    Post back if that does not help.

  • Put a graphic over/in a video clip

    What I'm trying to do is put the logo Baywatch (but my own version, something stupid like Boobwatch) over a beach scene I have. Since it's not a font, can I do this in iMovie in anyway? I'd create it in Photoshop, but can I get the graphic on top of the video? Something how you put on font on the video rather than "Over Black." I want to put the graphic on the clip.
    If not, are my only other options exporting the video to Photoshop and doing it all in there? Or the second option, making the font?

    I need to buy the plug-ins to do this correctly, but in the meantime, here's what you can do. It won't put your logo over the TOP of the background footage, but it may work until you purchase the plugin that's needed:
    1. Add an edit mark at the beginning and end of the sequence you want to overlay the logo. To put an edit mark, press Apple Key and 'T' at the same time.
    2. Click the clip inside the edit marks by simply clicking on it. It turns dark blue.
    3. Go to Advanced pull-down options and select Extract Audio. This will pull the audio from the selected clip and place it in one of the two audio tracks below the video clips.
    4. While the video clip is still selected, delete it by pressing the Delete key. Don't empty the iMovie trash just in case you need to Undo your move.
    5. Move the logo into your iMovie clip bin, then move it into the video timeline exactly where your previous clips was deleted. If it's longer or shorter than the extracted audio clip below it, double-click the logo image in the timeline and adjust it's duration. I think default is 0:05:00 seconds, but that can be changed. If you imported the logo image from iPhoto, it may have the Ken Burns move pre-selected, in which case you need to un-select Ken Burns, then adjust the duration of the logo image.
    6. Now your extracted audio should play seamlessly along with the logo image.
    Message was edited by: Daniel Filice

  • Is anyone using iPhoto having a problem with the slide show using shatter where it does not let you put a title over photo?

    Is anyone using iPhoto having a problem with the slide show using shatter where it does not let you put a title over photo? It use to work but it no longer lets you place a title over the opening photo.

    Is your signature still current?(iPhoto '08, OS X Mountain Lion (10.8.4))    I can confirm this for iPhoto '11; Shatter will only show the text slide title between the slides. Ken Burns and Classic theme can still be set to overlay the caption and title directly over the slides.

  • Can we put a button on stack canvas

    Hi
    can we put a button on stack canvas
    and if we write hide_view it works??
    Please guide
    Vikas

    Vikas,
    We can put button on Stacked Canvas, and if you want to use HIDE_VIEW the stacked canvas in that button, then first you have to move the cursor to another item which belongs to other canvas,
    OR
    you have to set the Mouse Navigable and Keyboard Navigable properties of that button to FALSE.
    If this is not what you want then please explain what you actually want to achieve.
    Regards,
    Manu.
    If my response or the response of another was helpful or Correct, please mark it accordingly

  • Graphics layer over video Layer problem

    Hello!
    we are blu-ray applications developers and we have a problem with repainting graphics layer over video layer. In MHP this problem is solved using the method call repaint() to the HScene. This Method remove all graphics and paint again. But in Blu-ray is not work correctly. When you have a graphics over video, this graphics don´t disappear when you paint other graphics, because don´t refresh the HScene and all the containers get painted over the others.
    what is the solution of this problem?
    Thanks a lot for your help!
    Regards

    Thanks for your reply.
    As far as I know, targas can only be RGB. I couldn't find a way in Photoshop to work in YCbCr. I have Photoshop CS, so its pretty old, but even on my work computer, which has CS3, I didn't see anything. Next week I'll be installing CS4, so there might be something in that.
    I won't be able to test anything until late tonight, but I'll try several formats to see if they make a difference. I'm wondering if there might also be some kind of option in FCE to convert imported graphics to the correct color space.
    When keying graphics over video in your projects, how do you save them(formate,color space, etc)? Ever see this issue?
    Thanks for your help
    Colin

  • When i put my mouse over a tab it used to show the site now it dose not

    when i put my mouse over a tab it used to show the web page now it dose not do that any ideas
    == This happened ==
    A few times a week
    == im not sure

    Tab Scope: https://addons.mozilla.org/en-US/firefox/addon/4882/
    Image size can be set to 2 levels and viewed with +/- built-in to the add-on drop-down interface/image.

Maybe you are looking for