Flash AS3 - 3D engine help - masks & layers

I am trying to create an AS3 3D engine, it has gone well so
far, but I am slightly stuck with how to make my character move
'behind' and object (eg. so if he walks behind a box, you can't see
his legs). He must also be able to walk in front of the object.
The character has a variable z axis, so it is impossible to
define exactly which objects will be in front or behind the
character.
It would be useful if I could do it without the use of
layers, but not neccessary. Any ideas?
thanks in advance.

you wanted to say: "The character has a variable z axis, so
it is
possible to define exactly which objects will be in front or
behind the character."
the objects must be in the same layer and U can control the
order with swapDepths

Similar Messages

  • Basic Flash/AS3 Question - Please help!

    I am pretty new to ActionScript 3 and Flash. I don't want my movie clip to play unless the person's mouse curser is on the movie clip for more than a second. If the person just runs their curser over the movie clips really quickly, then it should do nothing. It must be more than a second. How do I code that?
    ActionScript Code I have that needs to be altered:
    stop();
    var myTimer:Timer = new Timer(1000, 1);
    myTimer.addEventListener(TimerEvent.TIMER, timerListener);
    function timerListener (e:TimerEvent):void{
    gotoAndPlay("over1");
    image1.addEventListener(MouseEvent.MOUSE_OVER, image1overFunc);
    function image1overFunc(e:MouseEvent):void {
    myTimer.start();

    stop();
    var myTimer:Timer = new Timer(1000, 1);
    myTimer.addEventListener(TimerEvent.TIMER, timerListener);
    function timerListener (e:TimerEvent):void{
    gotoAndPlay("over1");
    image1.addEventListener(MouseEvent.MOUSE_OVER, image1overFunc);
    image1.addEventListener(MouseEvent.MOUSE_OUT, image1outFunc);
    function image1overFunc(e:MouseEvent):void { myTimer.start();
    function image1outFunc(e:MouseEvent):void {
    myTimer.reset();

  • Using box2d flash as3 engine for iphone apps

    Hi
    have any body tried box2d flash as3 libraries working with flsh cs5 iphone apps.? when i compile app it give many errors, using flash player 9 give one error b2fixture undefined type error. any body developing physics base games as3 for iphone please share any good as3 physics base game engine.
    Thanks

    If you are targeting all iDevices I strongly suggest to forget about the Box2D. There is absolutely no way you can get (almost) any kind of physics simulation running smoothly with 1st and 2nd generation iDevices with current version of Packager for iPhone.
    And it really is graphics that is the problem more than anything else. Forget about caching Sprites or MovieClips. Actually don't use MovieClips and Sprites at all, it's just too slow. Instead start extending Bitmap class with your own animation system (swapping BitmapData) and mouse handling (hitTestPoint), there's plenty of examples.
    And then if you write really really optimized code you can get one fluently moving and animated sprite object running on your iPhone or iPhone 3G (with out doing anything else than just moving and animating that one object). More than one (animated and/or moving) object causes serious performance problems. You don't notice this as linear slowing in FPS (which would still be kind of ok), but it's more like skipping frames every now and then. This looks and feels really disturbing and makes designing of games pretty hard...Using GPU mode doesn't make any difference.
    But to answer the question, I'm pretty convinced that you can get (simple) Box2D simulation running smoothly on iPhone if you:
    1. Target only 3rd generation iDevices and above
    2. Use only Bitmaps as graphics
    3. Do rotations with pre-rendered frames (or don't use rotation at all)
    4. Optimize Box2D and your code thoroughly
    Just for **** and giggles I think I try to get some kind of physics simulation running on 3G too...
    By the way, comparing performance of 1st generation iPhone to HTC Desire (I happen to own both too) is like comparing C-64 to my shiny new Phenom II X6 rig. If you just look at the specs:
    HTC Desire:
    1 GH ARM v7
    AMD Z430 GPU
    576 Mb DRAM
    iPhone 3G:
    ARM 1176JZ(F)-S (underclocked to 412 MHz)
    PowerVR MBX Lite 3D
    128 Mb DRAM

  • How to load html page or website in flash as3

    hi
    how to load html page or web link (www.google.com)  in flash as3.
    please help me...

    Use the navigateToURL function...
    var url:String = "http://www.wherever.com";:
    var req:URLRequest = new URLRequest(url);
    navigateToURL(req);
    OR in one line...
    navugateToURL(new URLRequest("http://www.wherever.com"));

  • Controlling External Captivate 5 swf using flash AS3

    Hi,
    I have created a basic Flash AS3 interface in which I am trying to control the navigation (next slide / previous slide) of an external captivate 5 swf which I have added using a loader, but i cant work out the solution.
    My code is currently as follows:
    import flash.net.URLRequest;
    var Xpos: Number = 96
    var Ypos: Number = 94
    var my_loader:Loader = new Loader();
    my_loader.load(new URLRequest("content.swf"));
    my_loader.x = Xpos;
    my_loader.y = Ypos;
    addChild(my_loader);
    stop();
    nextBut.addEventListener(MouseEvent.MOUSE_UP,gotonextframe);
    function gotonextframe(event:MouseEvent){
    MovieClip(my_loader.content).rdcmndNextSlide();
    Any help would be much appreciated,
    thanks
    Dez

    Thats perfect, thanks for the reply, much appreciated!
    I guess you have tried:
    rdcmndRewindAndStop
    Set to 1 to rewind and stop the project.

  • Mask layers in button symbols not working?

    Hi!
    I am making a button symbol with many graphical elements
    placed in separate layers. I also want to use regular (not
    scripted)mask layers inside the button symbol but it doesn't work
    when I test the movie. In the authoring environment tha masking
    effect shows up properly but when I test the movie it just stacks
    the layers on top of each other as regular layers.
    Is this a bug? In previous falsh versions I think this method
    was working fine.
    Why is this happening? Attila

    reinhat wrote:
    > Hi!
    > I am making a button symbol with many graphical elements
    placed in separate
    > layers. I also want to use regular (not scripted)mask
    layers inside the button
    > symbol but it doesn't work when I test the movie.
    that is correct. If you search the forum by "mask button" you
    will find posts
    going back many years saying that flash does not support
    masking within button.
    To work around that limitation, you can place your mask in
    movie clip and than
    that clip inside a button.
    Regards
    Urami
    Happy New Year guys - all the best there is in the 2006 :)
    <urami>
    http://www.Flashfugitive.com
    </urami>
    <web junk free>
    http://www.firefox.com
    </web junk free>

  • How to get this PHP list in Flash AS3?

    Hi,
    I have the following PHP code (downloaded from net) which builds a list of all the files in a "MyPics" folders:
    PS php can build a list of all the files in a folder so you don't have to type them all out like that, plus it makes updating a sinch all you have to do is put a pic in the folder and it will be added to the list.
    PHP Code:
    <CODE>
    <?
    //this function goes through the defined directory and makes a list of all the files
    function parse_dir($dir,$level){
        $dp=opendir($dir); //opens the directory for reading
        while (false!=($file=readdir($dp))){  //runs until no more files
            if ($file!="." && $file!=".." && $file!=".htaccess"){  //so you don't get all the default folders
                $countervar=$countervar+1;  //just a counter for numbering the path names
                if (is_dir($dir."/".$file)) parse_dir  //recurses the subdirectories
    ($dir."/".$file,$level+1);
                else print "&path".$countervar."=".$dir."/".$file;  //pieces together something flash can read
    $start_dir="pathToMyPics";  //put the name of the folder with all the pics here
    $level=1;
    parse_dir($start_dir,$level);
    ?>
    <CODE/>
    The above php will output something like this
    &path1=pathToMyPics/pic1.jpg&path2=pathToMyPics/wowWhatAWierdPicName.jpg
    call the php in flash( loadVariables("fileListPHP.php") ) and viola you get easy to use paths to all you pictures.
    I am not able to understand the code to write on FLASH AS3 frame. Please help.
    Thanks.

    In AS3 you want to use the URLVariables class.  Search Google using "AS3 URLVariables tutorial" and you should find what you need to get going.  Here's one result from that search...
    http://www.metah.ch/blog/2008/01/using-urlvariables/

  • Flash as3 code in Cap 7

    I would like to add a flash AS3 movie and buttons in my Cap project that would goto certian slides. I've looked everywhere to find  some code that would help me on my way, but no luck. Can anyone here help?
    THanks

    If you create a new widget in Captivate it will supply with the code to access Captivate. This should get you there.
    http://www.infosemantics.com.au/widgetking/category/captivate-variables/

  • Stacking several masking layers don't work.

    Hi,
    The attachment contains two screen shots of a movie clip timeline.  The images consist of a text mask symbol sliding diagonally other a text layer, and a picture button sliding to the left under an aqua blue mask.
    When I scrub the timeline -- things work great. But when I view the movie via the control menu, the dynamic text is not displayed.
    The images illustrate the masking layers in unlocked and locked mode.
    I have no idea on how to fix the problem. Any suggesting is appreciated.
    Thanks,
    King
    PS: I'm using CS4.

    From the labrary components, its module object is: MultiPage>page1>page1_mc
    However, I realized, I forgot to meantion the keyframe on the main time line. Do the following steps.
    An alternative method to see the timeline starting from the stage is to put the bottom layer, whole Gallery in outline mode.
    On the main time line select keyframe 4, on bottom layer.
    Put the mouse on the second green outline box from the left-bottom croner of the stage. It should change to a 4-way arror.
    Double click on it. Module frameMulti_mc should open up. Then put  layer page1_mc in outline mode.
    Lock all layers but for page1_mc. Select keyframe 1 on layer page1_mc. A movieclip circle should appear 
    Double click the movie clip circle in the middle of the left object. A time line with 36 frames should appear.
    scrub it to frame 36. The text should appear.
    Also, if you run it via the test movie command, it's gallery 4 in the movie swf.
    I also attached a flash CS4 Classroom In a Book illustration file. It's the example I'm trying to simulate.

  • Creating a file on server, using Flash AS3 + PHP

    I have a very simple PHP script that creates a new file on my server using a random number for the file name (e.g., 412561.txt).  When I load the script directly from a browser, it works.  But when I load the script from a very simple Flash (AS3) script, it does not work (i.e., doesn't create a file).  The Flash script and PHP script are both in the same directory.  Permissions on the directory and its content are 755.  Temporarily setting those permissions to 777 does not solve the problem (i.e., PHP still doesn't create file when called via Flash).
    Here is my phpinfo.
    Here is the PHP file.
    The contents of the PHP file are:
    <?php
    error_reporting(E_ALL);
    ini_set("display_errors", 1);
    $RandomNumber = rand(1,1000000);
    $filename = "$RandomNumber" . ".txt";
    $filecontent = "This is the content of the file.";
    if(file_exists($filename))
              {$myTextFileHandler = fopen($filename,"r+"); }
    else
              {$myTextFileHandler = fopen($filename,"w"); }
    if($myTextFileHandler)
              {$writeInTxtFile = @fwrite($myTextFileHandler,"$filecontent");}     
    fclose($myTextFileHandler);   
    ?>
    Here is the html container for the Flash script.  The Flash script features a single button which calls the PHP script when pressed.  In case it helps, here is the raw Flash file itself.  The code of the Flash script is as follows:
    stop();
    var varLoader:URLLoader = new URLLoader;
    var varURL:URLRequest = new URLRequest("http://www.jasonfinley.com/research/testing/TestingSaveData.php");
    btnSave.addEventListener(MouseEvent.CLICK,fxnSave);
    function fxnSave(event:MouseEvent):void{
              btnSave.enabled=false;
              varLoader.load(varURL);
    Directory listing is enabled at the parent directory here, so you can see there when a new text file is created or not.  (Um, if this is a security disaster, please let me know!)
    Can anyone please help me understand why this isn't working and how I can fix it?  Thank you
    ~jason

    #1, Yes that is a security risk, please disable directory index viewing.
    #2, Always validate. I see no issue with the code you're using but clearly it's not working. The way you find out is your trusty errors.
    Make a new document (or paste this into your existing) where a button with the instance name btnSave is on screen:
    // import required libs
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.events.Event;
    import flash.events.IOErrorEvent;
    import flash.events.MouseEvent;
    import flash.events.SecurityErrorEvent;
    import flash.text.TextField;
    // assign handler
    btnSave.addEventListener(MouseEvent.CLICK, fxnSave);
    // make a textfield to display status
    var tf:TextField = new TextField();
    addChild(tf);
    tf.width = stage.stageWidth;
    tf.height = 300;
    tf.multiline = true;
    tf.wordWrap = true;
    tf.selectable = false;
    tf.text = "Loading...\n";
    // just making sure the textfield is below the button
    this.swapChildren(tf,btnSave);
    function fxnSave(event:MouseEvent):void
        // disable button
        event.currentTarget.enabled = false;
        // new loader
        var varLoader:URLLoader = new URLLoader();
        // listen for load success
        varLoader.addEventListener(Event.COMPLETE, _onCompleteHandler);
        // listen for general errors
        varLoader.addEventListener(IOErrorEvent.IO_ERROR, _onErrorHandler);
        // listen for security / cross-domain errors
        varLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, _onErrorHandler);
        // perform load
        varLoader.load(new URLRequest("http://www.jasonfinley.com/research/testing/TestingSaveData.php"));
    // complete handler
    function _onCompleteHandler(e:Event):void
        tf.appendText("Load complete: " + e);
    // error handler
    function _onErrorHandler(e:Event)
        if (e.type == SecurityErrorEvent.SECURITY_ERROR)
            tf.appendText("Load failed, Security error: " + e + " type[" + e.type + "]");
        else if (e.type == IOErrorEvent.IO_ERROR)
            tf.appendText("Load failed, IO error: " + e + " type[" + e.type + "]");
    I get a Event.COMPLETE for mine, so the PHP script is definitely firing. Change the URL to something invalid and you'll see the IOErrorEvent fire off right away.
    That leaves you to diagnose the PHP script. Check your error_log and see what is going wrong. You're suppressing errors on your file write which doesn't help you locate the issue saving the file. If you want to handle errors yourself you should do the usual try/catch and handle the error yourself (write a debug log file, anything).

  • Flash cs4 deletes frames on locked layers

    Hello!
    I have a problem. While I am drawing, and deleting while all other layers are locked except the one I draw on,
    flash deletes frames from the locked layers on the timeline randomly.
    It is very annoying, because its a bug, and sometimes I need to redraw a lots of my works.

    I am having this EXACT same error message, but it is happening whenever I make a movieclip within a fla file. Once I rotate through the error the movie clip appears as only an outline box on my stage, although opening the button (along with the error showing up again) is viewable and editable. Anything I try to do with the clip...edit, move, anything... the error pops on my screen repeatedly.
    This all started after I had a major crash and had to reinstall my system. My registration of CS4 Design Premium was messed up so I ran the Flex Licensing app as suggested by the Adobe site. All other programs work fine... just Flash is messed up. HELP!
    P.S... I did try the deletion of prefs, etc as suggested here... that did not work. Also, the file I am working on works fine on another computer running the same version of flash, so it has to be related to a missing or corrupted file I'm guessing, but I don't know which one. I even uninstalled and reinstalled flash to no avail.
    -------------------ANSWER FOUND PROBLEM FIXED!!!!--------------------
    After 10 days I finally found the solution that worked on twelvestone.com
    tonzeejee 2010.01.05,  01:32AM — SOLUTION...
    [ in the barrel ]
    posts: 1       join date: 2010.01.05
    Here's the solution if you're on a Mac running 10.5.X or later...
    QUIT Flash (don't CLOSE the window - QUIT the app completely (Flash menu next to the apple menu > "Quit")
    Browse to Macintosh HD/Users/"your user name"/Library/Application Support/Adobe
    Completely  delete the folder called "Flash CS4" or "Flash CS3", depending on which  version you're using. This means empty the trash.
    Re-launch Flash app - should be good to go.

  • Exporting LR4 Slideshow into Flash AS3 Website?

    Hello,
    I would like to export a LR4 Slideshow into my website that was coded entirely in Flash AS3. I have tried the LR4 Slideshow "export options" but I can not seem to make this work. Does anyone have any suggestions? Is this possible? Since I edit most of my photos in LR4, I would like to be able to use LR4's slideshow option on my website without having to reload my photos into an external slideshow program. Thanks.

    Please, I really need your help!

  • WHERE IS THE ICON FOR MASKING LAYERS IN PHOTOSHOP 7??????????

    Where is the icon for masking layers in photoshop 7????????????????????????????/

    One ? should suffice, and why the capital letters?  Try to remain calm.  I know Photoshop can be frustrating, but In the grand scheme of things your inability to find a control in an application you're using really doesn't need such emphasis...  Please look up "netiquette" when you have a chance.
    Try hovering your cursor over things and look at the ToolTip help balloons that pop-up.
    You can add a Layer Mask by choosing Layer - Add Layer Mask from the menus.
    If you're seeking the icon on which to click to begin painting on a Layer Mask, this is the one you want:
    If you are talking about making layers visible or invisible, that's the little eyeball icon at the left of each layer in the Layers palette.
    -Noel

  • Problems setting up my TC. Have just bought new iMac(OS 10.6.8) and  TC. I set it up. iMac cannot find it. I have tried direct connection with an ethernet cable to Mac or my wireless router but nothing. Just a flashing orange light. Help for a simpleton p

    Problems setting up my TC. Have just bought new iMac(OS 10.6.8) and  TC. I tried to set it up. iMac cannot find it. I have tried direct connection with an ethernet cable to Mac or direct to my wireless router but nothing. Just a flashing orange light. Help for a simpleton please. Have tried reseting TC, but to no avail.

    Just updated from 10.6.7 ---> 10.6.8 and had the same issue. Despite having done a clean install from 10.6 and got everything back off my TC, now Time Machine can't find it!
    Green light is on, ethernet cable conected, network CP says its conected but nothing. Airport Utility can't find it. Hit reset button, Orange flashing light but still no show in Airport Utility.
    But I know its there, as rebooting from 10.6 SL disk shows the backups are still ok?
    Hmm, ideas anyone?
    SBB

  • My iphone 4 was on ios 5.0.1, then a few days ago I upgraded it to ios 6.1.4, then the apple logo won't stop flashing. Can anyone help to resolve my problem? Thanks in advance

    My iphone 4 was on ios 5.0.1, then a few days ago I upgraded it to ios 6.1.4, then the apple logo won't stop flashing. Can anyone help to resolve my problem? Thanks in advance

    I'm trying to restore my iphone by using the recovery mode. But it always seems to run out of time, any idea why is that? Thank you again

Maybe you are looking for