PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
One night in Actionscript
A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: One night in Actionscript

  1. #1
    Junior Member
    Join Date
    Jun 2010
    Posts
    7

    One night in Actionscript

    Hey guys, I'm new to Actionscript (Flash in general) and recently worked out an animated die (dice) last night. I was all happy with my first working code that actually does something.

    Well, I come back this morning, open the same file, take a look at the code, everything is kosher, and run it and I get a ton of errors that I had not seen before and the script no longer runs correctly. I double check the code and go through the error and I can see nothing wrong.

    I was hoping you guys can help me out. Here are the errors.


    Scene 1, Layer 'actions', Frame 41, Line 11 1021: Duplicate function definition.
    Scene 1, Layer 'actions', Frame 80, Line 1 1151: A conflict exists with definition max in namespace internal.
    Scene 1, Layer 'actions', Frame 80, Line 2 1151: A conflict exists with definition min in namespace internal.
    Scene 1, Layer 'actions', Frame 80, Line 3 1151: A conflict exists with definition randomNumber in namespace internal.
    Scene 1, Layer 'actions', Frame 81, Line 11 1021: Duplicate function definition.
    Scene 1, Layer 'actions', Frame 120, Line 1 1151: A conflict exists with definition max in namespace internal.
    Scene 1, Layer 'actions', Frame 120, Line 2 1151: A conflict exists with definition min in namespace internal.
    Scene 1, Layer 'actions', Frame 120, Line 3 1151: A conflict exists with definition randomNumber in namespace internal.

    here is my script

    Actionscript Code:
    var max:Number = 6;
    var min:Number = 1;
    var randomNumber:Number = Math.round(Math.random() * (max-min) + min);


    rollDie_mc.x = stage.stageWidth / 2 - rollDie_mc.width / 2;
    rollDie_mc.y = stage.stageHeight / 2 - rollDie_mc.height / 1.5;
    roll_btn.x = stage.stageWidth / 2 - roll_btn.width / 2;
    roll_btn.y = stage.stageHeight / 2 - roll_btn.height + 175;



    if(randomNumber == 1)
    {
        rollDie_mc.gotoAndStop("pip1")
    }
    else if(randomNumber == 2)
    {
        rollDie_mc.gotoAndStop("pip2")
    }
    else if(randomNumber == 3)
    {
        rollDie_mc.gotoAndStop("pip3")
    }
    else if(randomNumber == 4)
    {
        rollDie_mc.gotoAndStop("pip4")
    }
    else if(randomNumber == 5)
    {
        rollDie_mc.gotoAndStop("pip5")
    }
    else if(randomNumber == 6)
    {
        rollDie_mc.gotoAndStop("pip6")
    }



    stop();


    So the confusing part for me is that all the errors come in after the movie is over, in that I only have 40 frames in my .swf but the first error occurs on 41.

    Also, " namespace internal" seems like it may be holding the number originally generated? I don't know. Its over my head. I searched online and the only thing I got with the error code 1151 is that I have to change it to Flash 7(?) which seemed odd.

    Anyways, hopefully you guys can give me some feedback, I was thinking I could probably start from scratch and get it working again, but I'd rather figure out what went wrong to avoid it on a later date.

    Thanks guys

    Actionscript 3.0

    Edit: dang, I also intended to put this guy in the Actionscript 3.0 forum

    Also, here is a zippyshare link for the .fla file
    http://www29.zippyshare.com/v/99538050/file.html
    Last edited by harper.rb; 06-25-2010 at 01:56 PM.

  2. #2
    Flash/Flex Developer samac1068's Avatar
    Join Date
    Apr 2007
    Location
    Here, no there
    Posts
    1,813
    These error are telling you that you've defined the variables max and min along with a function in both frames 41, 80, 81, 120. You will only declare a variable once unless it is a local variable, but since you have it in the timeline, this is not the case. Also, you don't need to have a function each frame you want to run it. Best choice is to define both your variables and function in the first frame and you can use those values throughout the timeline, UNLESS YOU INSERT BLANK KEYFRAMES.

    Check your code for these duplicates.
    Some people are like Slinkies, not really good for anything, but they bring a smile to your face when pushed down the stairs.

  3. #3
    Junior Member
    Join Date
    Jun 2010
    Posts
    7
    Sorry if I am completely missing something. But to my knowledge there are no frames past 40 [screen shot attached] so and all the frames between 1 and 40 are blank as they have no symbol.

    frame 1 has no variables.


    Frame 1 script
    Actionscript Code:
    rollDie_mc.x = stage.stageWidth / 2 - rollDie_mc.width / 2;
    rollDie_mc.y = stage.stageHeight / 2 - rollDie_mc.height / 1.5;
    roll_btn.x = stage.stageWidth / 2 - roll_btn.width / 2;
    roll_btn.y = stage.stageHeight / 2 - roll_btn.height + 175;




    function roll(event:MouseEvent):void
    {
        rollDie_mc.play();
        gotoAndPlay(2);
    }

    stop();
    rollDie_mc.stop();
    roll_btn.addEventListener(MouseEvent.CLICK, roll);

    So I am at a loss what to do. as you can see in the image there is nothing in 80.

    Thanks for the response.

    Also, I could be missing something obvious, I am still very new to this.
    Attached Images Attached Images

  4. #4
    Junior Member
    Join Date
    Jun 2010
    Posts
    7
    Ok! fix one problem!

    Turns out I had accidentally duplicated my scene 2x! I don't know how, I assume there's probably some short key and I probably got it mixed up with a short key I use for illustrator or Photoshop.

    So that was the reason it continued to see multiple copies of the code that I only had 1 copy of.

    But I had this other error creep in. And I m not sure how to get rid of it. I did some searching but it all seemed relatively unrelated to what code I have.

    its a window that pops up every time I try to load the .swf in flash.

    here:

    -=-=-=-=-=-=-=-
    The warning:

    Runtime Shared Library Preloading Warning

    Your content will not stream. Runtime Shared Library (RSL) preloading will require all of your content to download before the first frame will play.

    To prevent this you can chane the Runtime Shared Library Library Settings in the Advanced ActionScript 3.0 Settings dialog which can be raised from the Publish Settings dialog.

    The Runtime Shared Libraries being preloaded are:

    textLayout_1.0.0.595.swz for TLF Text

    -=-=-=-=-=-=-
    So, I m not exactly sure what any of this is. I've seen other people mention it, but its over my head. Any suggestions? It may be cause I hit some hot key or something.

    Thanks guys

  5. #5
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    Moved to AS 3.0

    gparis

  6. #6
    Flash/Flex Developer samac1068's Avatar
    Join Date
    Apr 2007
    Location
    Here, no there
    Posts
    1,813
    My flash has crashed here, so can you post all of your code?
    Some people are like Slinkies, not really good for anything, but they bring a smile to your face when pushed down the stairs.

  7. #7
    Junior Member
    Join Date
    Jun 2010
    Posts
    7
    sorry it took me as long as it did to get back. I was waiting for a notification email, but I guess when the thread got moved, it bumped off my notifier. But no worries.

    I restarted the program just today and bamf, everything is working. I dunno. I guess the program just needed a restart to clear some bad memory or something. The previous warning window I mentioned is no longer there.

    So everything seems to be running great for that little app.

    However, I did run into another problem in a different project. So I guess Ill just post that here instead of starting another thread.

    I'm still new to this and I just started working with classes. I created a custom class that modified the Movie Clip base class. Everything was going great and worked perfectly all the way up to applying my custom class to more than 1 symbol in the properties (through the library window)... so, just to clarify, custom class worked fine with my first symbol (with the custom class in the "Class" box), then I added it to other symbols (putting the custom class in the "Base Class" box), and now I get error messages saying that the custom class needs to be linked to the Movie Clip class in flash.etc.etc

    Here's the error
    cris, Line 4 1152: A conflict exists with inherited definition DragDrop.__cacheXMLSettings in namespace public.
    C:\Users\RHr\Documents\My Projects\My Flash Projects\DragDrop.as, Line 1 5000: The class 'DragDrop' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type.
    C:\Users\RHr\Documents\My Projects\My Flash Projects\DragDrop.as, Line 1 5000: The class 'DragDrop' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type.
    C:\Users\RHr\Documents\My Projects\My Flash Projects\DragDrop.as, Line 1 5000: The class 'DragDrop' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type.
    and I have the linkage (I thought it was correctly placed) near the top.

    Here's my code in my DragDrop.as file

    Actionscript Code:
    package
    {
        import flash.display.MovieClip;
        import flash.events.MouseEvent;

        public class DragDrop extends MovieClip
        {
            public var target:MovieClip;
            private var originalX:Number;
            private var originalY:Number;
           
            public function DragDrop()
            {
                originalX = this.x;
                originalY = this.y;
                this.addEventListener(MouseEvent.MOUSE_DOWN, drag);
            }
            private function drag(event:MouseEvent):void
            {
                this.startDrag();
                this.parent.addChild(this);
                this.addEventListener(MouseEvent.MOUSE_UP, drop);
            }
           
            private function drop(event:MouseEvent):void
            {
                this.stopDrag();
                this.addEventListener(MouseEvent.MOUSE_UP, drop);
                           
                if(this.hitTestObject(target))
                {
                    this.visible = false;
                }
                else
                {
                    this.x = originalX;
                    this.y = originalY;
                }
            }
        }
    }

    and finally the .ai code


    Actionscript Code:
    var people:Array = [me1_mc,me2_mc,others1_mc,others2_mc,others3_mc,others4_mc,others5_mc,others6_mc,others7_mc,others8_mc]

    function assignTargets():void
    {
        var instaceName:String;
       
        for(var i:uint = 0; i < people.length; i++)
        {
            instaceName = people[i].name;
            if(instanceName.indexOf("others") != -1)
            {
                people[i].target = othersbox_mc;
            }
            else
            {
                people[i].target = mybox_mc;
            }
        }
    }


    So I don't know whats going on, I've tried moving around the imports, but that didn't work...

    I'm going to keep plugging at it some more, but maybe you can see something that I am totally missing.

    Thanks for your help

    R

  8. #8
    Flash/Flex Developer samac1068's Avatar
    Join Date
    Apr 2007
    Location
    Here, no there
    Posts
    1,813
    Well I'm not sure if I completely understand, but regardless if you are assigning a object to a custom class, you need to identify the base class for it, in this case flash.display.MovieClip.
    Some people are like Slinkies, not really good for anything, but they bring a smile to your face when pushed down the stairs.

  9. #9
    Junior Member
    Join Date
    Jun 2010
    Posts
    7
    correct. Is that not what I did in the .as code at the top "import flash.display.MovieClip;"?

    Or is that only importing the base class, not identifying?

  10. #10
    Junior Member
    Join Date
    Jun 2010
    Posts
    7
    "The class 'DragDrop' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type."

    Is "subclass" the same as the "import" script? Or do I have to subclass somewhere else?

  11. #11
    Junior Member
    Join Date
    Jun 2010
    Posts
    7
    Ugh, been working on it. And I think the problem may be that I have text embedded in the symbol.

    Is there something I have to do inside the MovieClip object for text specifically?

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