Making Chess puzzle in Flash

Hi guys!
I'm pretty new to Flash, but I love chess and would like to
make chess puzzles in Flash to get more familiar with the program.
I've looked in my CS3 book and browsed google for tutorials, but
didn't find any on chess. Then I figured that maybe some nice
people at these forums would help me out!
I have a board and my pieces, and I imagine it like, say, 4
squares will be highlighted, and then the user can drag a chess
piece onto any of them, but only one will be right (the others
produce failure messages). Then when they find the right square, I
make the game make a move, and then they have to find the next
move, then the game moves, and then they have to find the mating
move.
Frankly, I don't know what to type in my actionscript for
this to happen.
Help me out a bit?
Thanks, Carina
www.carlinart.net (<-- home to my other chess art
;))

Hi Carina,
just something to get you going, this could be a way to set
it up.
It assumes there's a number of movieClips on the stage with
instancenames like in the array.
it assumes you actually guide the player through a set of
moves like
replaying a done game, possible position of other pieces are
not taken
into account
Watch for wrapping...
// these are the square movieClipt that make up the board,
not a
complete board,
// nor the smartest way to set it up, but for a small POC
it's OK
var board:Array = new Array();
board.push( new Array( sq_00_mc, sq_01_mc, sq_02_mc,
sq_03_mc, sq_04_mc ) );
board.push( new Array( sq_10_mc, sq_11_mc, sq_12_mc,
sq_13_mc, sq_14_mc ) );
board.push( new Array( sq_20_mc, sq_21_mc, sq_22_mc,
sq_23_mc, sq_24_mc ) );
board.push( new Array( sq_30_mc, sq_31_mc, sq_32_mc,
sq_33_mc, sq_34_mc ) );
board.push( new Array( sq_40_mc, sq_41_mc, sq_42_mc,
sq_43_mc, sq_44_mc ) );
// possible moves this game
var moves:Array = new Array();
// first move of game, each move should contain a
startposition,
possible moves (and possible a 'solution-position'?)
moves.push( { startpos: {x: 3, y: 2}, possiblemoves: new
Array( {x: 3,
y: 1}, {x: 2, y: 2}, {x: 3, y: 3} ) } );
// etc. for other moves
// set move to 0, the first
var currentMove:uint = 0;
// load move into game
loadMove( moves[ currentMove ] );
function loadMove( aMove:Object )
// get square of current moveable piece
var currSquare:MovieClip = board[ aMove.startpos.y ][
aMove.startpos.x ];
// hilight startpos of currentMove
currSquare.transform.colorTransform = new ColorTransform( 1,
1, 1, 1,
0, 0, 128, 0 );
for ( var i:uint = 0; i < aMove.possiblemoves.length; i++
currSquare = board[ aMove.possiblemoves
.y ][
aMove.possiblemoves.x ];
trace( currSquare.name );
currSquare.transform.colorTransform = new ColorTransform( 1,
1, 1, 1,
0, 0, 128, 0 );
Manno Bult
http://www.aloft.nl

Similar Messages

  • Making a road in Flash

    Hi,
    I want to make a road in flash. You got a road with white stripes on it but it aint moving. I want the stripes to come at you to make it like you are driving the road.... Its not a straigt road but diagonal and dissapearing at the eind of the horizon... Does someone know how I can make this like it is real? It has to loop over and over again...
    Tnx
    Joep

    When you say it is a diagonal road you mean like this:
    /|
    where the vanishing point is in one corner of the screen?
    Or do you want a road that curves as the movie loops?
    Rather than use ActionScript you would best refer to drawing techniques in Flash and making the start frame and endframe of the loop coincide with each other.
    To make the dashed lines you would simply motion-tween or classic-tween some narrow trapezoid shapes that are Movie Clips and go from there.  The border shapes would get curved based on the way you drew them on your stage and you could tween the dashed lines in accord with those curved lines.

  • Making a Quiz in Flash. Need help with input time

    Hi Flash Community,
    I'm making currently a quiz using Flash Pro CS5. What I want to implent is a time bar which will load once the bar is loaded it will go to the next frame.
    So what I need is first a timer which will start immediately when the user sees the question and I need a time bar which will indicate how far the timing is. So let's say you have 30 seconds to answer the quiz. When the timer is at 15 seconds the bar will be at half.
    Something like this http://www.google.nl/imgres?imgurl=http://theportablegamer.com/wp-content/uploads/2009/10/ question.jpg&imgrefurl=http://theportablegamer.com/tag/quizquizquiz/&usg=__xsykgRnehmB9P97 gg3W9tAx2Dfg=&h=320&w=480&sz=57&hl=nl&start=0&sig2=tdKlW2Iv6zHo3THsHwdVpQ&zoom=1&tbnid=ToM bL22o-D7BOM:&tbnh=107&tbnw=160&ei=aiz7TcGONI2gOpic0b4E&prev=/search%3Fq%3Dquiz%2Binterface %26um%3D1%26hl%3Dnl%26sa%3DN%26biw%3D1902%26bih%3D909%26tbm%3Disch&um=1&itbs=1&iact=rc&dur =317&page=1&ndsp=68&ved=1t:429,r:13,s:0&tx=100&ty=47
    Could anyone help me with this? How do I need to do this?
    Thanks!

    Create a movieclip with tween about 30 frames and actions stop() in the first frame
    AS3 code:
    import flash.utils.Timer;
    var timer:Timer=new Timer(1000);
    timer.addEventListener(TimerEvent.TIMER,fn);
    timer.start();
    function fn(e:TimerEvent):void{
        trace(mc.currentFrame);
        if (mc.currentFrame==30){
            timer.removeEventListener(TimerEvent.TIMER,fn);
        mc.gotoAndStop(mc.currentFrame+1);
    AS2 code:
    var n=setInterval(mcfn,1000);
    function mcfn(){
        trace(mc._currentframe);
        if (mc._currentframe==30){
            clearInterval();
        mc.gotoAndStop(mc._currentframe+1);

  • Making a LINUX Standalone Flash!

    Hi All,
    I can create executables for Windows and Mac. How do I create
    a standalone projector for Linux? Is it that I need an emulator? Or
    is there some way I can run an .exe or .app in Linux?
    Thanks in advance. Im in deep probs with Linux executables.

    When you say it is a diagonal road you mean like this:
    /|
    where the vanishing point is in one corner of the screen?
    Or do you want a road that curves as the movie loops?
    Rather than use ActionScript you would best refer to drawing techniques in Flash and making the start frame and endframe of the loop coincide with each other.
    To make the dashed lines you would simply motion-tween or classic-tween some narrow trapezoid shapes that are Movie Clips and go from there.  The border shapes would get curved based on the way you drew them on your stage and you could tween the dashed lines in accord with those curved lines.

  • Making my game in Flash - a few questions

    Hello all, I am quite new to Flash but I have a few years of experience in the other CS software, such as Photoshop, Illustrator, and InDesign. I downloaded the trial version of Flash and started working through some tutorials last night so I can get my feet wet with it.
    Anyway, I have a game that I would like to create, and I never considered making it Flash-based until I started working with Flash yesterday. I made this game in a board game form about 8 years ago, and it revolves around giant monsters ala Godzilla, etc. It is turn-based and two players move pawns space-by-space around the board and attack by rolling a die and then using a corresponding attack on the card. There are also some simple environmental objects, such as buildings around the arena that can be destroyed and used strategically. I would describe the game as a strategy game with elements of a card game and also simple RPGs. There are five levels of cards, and when you score a certain number of points, you level up to the next round of cards. You win the game by reaching a certain number of points. When I made this game, I also included very detailed rules and such with it, so that part is finished at least.
    Is this a feasible project to use Flash to do?

    Though the nitty gritty details haven't been disclosed, it sounds like it should be do-able in Flash.  I could say it would be easily created with Flash, but I don't want to give the impression that you personally can just pick up Flash and get it done without a good amount of learning to tackle in the process.

  • Are there any tutorials on making animated gifs in flash, from a video?

    I have an avi video file that i'd like to make into an animated gif in flash. How do I go about doing this? I know there is an option in photoshop where you can import the video frames onto layers. Is there something similar in flash?

    [http://wetpixel.com/forums/lofiversion/index.php/t16884.html]
    This might provide a bit of insight.

  • Making text links in Flash 8

    Hello,
    Does anyone no how to add links to a flash page step by step.
    I'm realy not sure how and how to make them link to another page?
    I thank you in advance,
    Vince

    To add link to a button, do the following:
    1- Create a button, which could be you text converted to a
    button
    2- Access the Action Script panel in the script assist mode
    (find its button in the top of the Action panel)
    3- choose getURL action from the left menu (find it in Global
    Functions> Broswer/Network> getURL)
    4- In th URL field, write the URL you would like you button
    to go to.
    And to make you text a link, you can do the following:
    1- Write the text you would like to be a link
    2- in the text properties panel, write your URL in the URL
    field
    Hope this helps

  • Making a Link in Flash Professional 8

    Hey,
    I'm wondering how to make a link in Flash Professional 8, any tutorials around?

    Linking to a web page and linking to another section of the same Flash file involves different code.  I'll show you examples of both wrt using a button for the interactive control.
    In this case the button is assigned an instance name of linkBtn (it's assign in the properties panel).  The code I show is placed on a frame that is the same as the button (different layers for good housekeeping).
    Link to web page:
    linkButton.onRelease = function(){
         getURL("http://www.yoursite.com/page.html");
    Link to section (section starts on a frame having a label... "section1"):
    linkButton.onRelease = function(){
         gotoAndStop("section1");
    OR
    linkButton.onRelease = function(){
         gotoAndPlay("section1");
    The difference between the two for the section link would depend on whether section1 is an animated timeline piece that would play when you get there or a self-contained movieclip that has controls of its own.

  • Making a button in Flash :(

    I'm really struggling with flash and i urgently need to create an ebook where the scenes are linked via buttons.
    If someone could quickly have a look at it, and try and fix the problem, i would be VERY thankful!
    If it wasn't important, i wouldn't ask!
    Let me know if your interested and i'll message you my work
    Thanks!

    hi gemma
    no promises, but if you can provide a link to your fla file i will take a look

  • Making Animation Smooth in Flash

    Hi there,
    I've just started using Flash today so my question may seem a
    bit lame . . . but here goes.
    I took a series of photos of a phone set that I dropped into
    Flash so that I could animate it spinning round. The spinning works
    fine but the overall is effect is bumpy as hell. Does anybody out
    there know how I can smooth it out so that the phone just spins
    with no obvious joins between each frame?
    I followed the in-built guide and used 'keyframes' is that
    right, or is there a better way to do this?
    Thanks,
    Ali

    It could be that your bitmap phone images are too large, and
    thus requiring too much processor power. When bringing photos or
    other bitmaps into Flash, it is best practice to bring them in at
    the actual size you want them to appear, so any resizing should be
    done before importing them into Flash. If you import a 1200x800
    photo into Flash and then reduce it within Flash to 600x400, Flash
    still treats it as a 1200x800 image.
    I also tend to do any jpeg formatting before importing into
    Flash, since you have greater control of jpeg settings. But this is
    a personal choice, and something you may want to experiment with.
    FYI, for some reason Fireworks does the best job of jpeg reduction
    (best image quality/smallest file size) compared to Photoshop,
    ImageReady and others (I learned this latter fact from one of
    Adobe's top designers, who couldn't explain it, but demonstrated
    that it's a fact).
    Increasing the frame rate to as high as 24 fps (same as
    TV/video) might help. Too high a frame rate will put even greater
    strain on the viewer's processor, since it has to deal with that
    many more bitmaps per second.

  • Making a puzzle

    Good Day,
    Is there way to do this in InDesign:
    Have a single background image (jpg or PDF) which you draw a puzzle pieces on top of using the Pen Tool (properly closing each of the pieces).
    Then, embed that bottom image as positioned in _each_ of the puzzle pieces so that it can be 'broken up' as individual pieces, but retain the image, as positioned?
    This would save LOT of work
    Currently using CS3
    Thanks!

    It's not really any strength of ID's. If I were to try what you suggest, I'd use a more graphically oriented program like Illustrator.

  • Making a bootable USB flash drive from PC

    My DVD drive on Imac is broken and won't recognize anything. It doesn't show up on disk utility and I can't make dmg file from it.
    So I have snow leopard DVD and I want to make a bootable USB flash drive on PC. I want to know how to copy the image from snow leopard dvd on PC. (windows xp)
    Please help!

    AFAIK, you can't use a PC. Consider one of these:
    http://www.amazon.com/LG-Super-Multi-SecurDisc-LightScribe-GE24LU20/dp/B003TTK2X 4/ref=lhni_t
    http://www.lg.com/us/computer-products/optical-media/LG-external-dvd-burner-GE24 LU20.jsp
    http://www.amazon.com/LaCie-16X-LightScribe-DVDRW-300982U/dp/B000BMNM9I#moreAbou tThisProduct

  • Making .swf files in Flash Pro CC: What versions of Flash Player could play it?

    Hello, all!
    I was recently let go from my last job. My former boss wanted me to do ActionScript work on a PowerPC Mac (an iMac G5) with a decade-old version of Flash (Flash MX 2004.) Her reasoning for this was sound: she wanted to distribute some of here English tutoring software to cash-strapped schools, so she wanted me to work with older software and hardware to ensure compatibility. Unfortunately (in this case) the only version of Flash Pro that I can legally acquire is Flash Pro CC, so I was unable to actually get my hands on anything that could run ActionScript 2. This made my productivity at work go slower than desired. Not only was I slow in picking up how to use Flash MX on a Mac (I'm primarily a Windows/Linux person) but she made it quite clear that she wasn't going to have me learning how to do the job on company time. In the end, she decided to scrap the project.
    Now, that job is gone, and what's done is done, but I'm still interested in using Flash/ActionScript, and I'm also left with a question that, depending on the answer, may have saved my job if I had asked it just a couple days ago: what's the oldest version of Flash Player that would be able to play .swf files made in the current version of Flash Pro CC?
    Thank you all for your time.

    with a cc subscription, you can download, install and activate flash pro cs6 which supports as2.
    the answer to your last question depends on what features you use of flash pro cc.  at a minimum you would be using as3 and need to use a flash player version that supports as3.

  • Flash port of Simon Tatham's Portable Puzzle Collection

    Hi,
    Recently I have ported Simon Tatham's Portable Puzzle Collection (http://www.chiark.greenend.org.uk/~sgtatham/puzzles/) to Flash using Alchemy. It's work in progess, only basic features implemented, and it's buggy, some games can't play at all ... I only added a ~30K flash front-end c file and it compiles but sometimes the compiler crashes ...
    (Where can I upload the source files? )

    Source file:
    http://sgtpuzzleflash.googlecode.com/files/puzzles_flash.7z Note:Download C source code at http://www.chiark.greenend.org.uk/~sgtatham/puzzles/ before!!!

  • Flash 9 downgrade to v7 for Windows CE

    We have a project that has been developed using Flex 2 and
    then generated into some Flash 9 SWFs. The developers did not
    appreciate that Windows CE, the platform for the product, cannot
    run Flash 9, only Flash 7.
    Is there a profiler tool that will highlight the methods and
    calls that are used in the generated SWF file that are making it
    incompatible with Flash 7?
    I do hope this makes sense to someone! Any pointers would be
    very useful indeed.

    the same puzzled me

Maybe you are looking for

  • Cannot send Emails from AOL (Mail App) Only Recieve

    For some time now i cannot seem to send emails from my AOL on the app (Mac Mail). I can receive ok, but not send. It remains in my outbox then a message appears: Cannot send message using the server AOL This operation couldn't be completed (MCMaiErro

  • I can't access the mac app store even though I have 10.6.8!

    I have a MacBook 1.83GHz and I have just downloaded 10.6.8 and I have the mac app store in my dock but it has a line through it and says I need 10.7 to open it. Before downloading 10.6.8 I still had it in my dock but it said i needed 10.6.8 to open i

  • Safari 8 keeps crashing

    When I open safari it crashes right away, here is the report Date/Time:       2014-12-06 12:08:40 -0500 OS Version:      10.10.1 (Build 14B25) Architecture:    x86_64 Report Version:  21 Command:         Safari Path:            /Applications/Safari.a

  • How to questions: manual synching, storing library externally

    * Why can't iTunes just let me files stay on an external hard drive? My laptop HD is too small for my collection and every time I try to say, "Hey look over on this external HD, it tries to copy the files to the hard drive." What can I do to tell it

  • I phone 4S keeps dying.

    My 4 month old iPhone 4S keeps dying, it happened 6 times in a row, should i be worried.  I got it back eventually by constantly hard rebooting.  Is this sinister.  I dont have apple care, can I take it in to be looked at, will they care?