13 Replies Latest reply on Oct 9, 2010 10:28 PM by kglad

    Error 1136

    beno12345 Level 1

      Hi;

      I have this statement in an *.as file:

       

      import Slideshow;

       

      I have this later:

       

      Slideshow();

       

      Slideshow(), for test, has the following code:

       

      package
      {
          import flash.display.MovieClip;

       

          public class Slideshow extends MovieClip {
             
              public function Slideshow() {
              }
          }
      }

       

      I get the following error:

       

      E:\DeJongh\DeJonghMain.as, Line 84    1136: Incorrect number of arguments.  Expected 1.

       

      What argument, pray tell, could it possibly be expecting??

      TIA.

      beno

        • 1. Re: Error 1136
          kglad Adobe Community Professional & MVP

          assuming Slideshow is not a document class, you should be using something like:

           

          var ss:Slideshow = new Slideshow();

          • 2. Re: Error 1136
            beno12345 Level 1

            Ok, what next?

            ss();

            E:\DeJongh\DeJonghMain.as, Line 85    1180: Call to a possibly undefined method slideshow.

            ss;

            TypeError: Error #1009: Cannot access a property or method of a null object reference.
                at Slideshow/loadImages()
                at Slideshow/processXML()
                at flash.events::EventDispatcher/dispatchEventFunction()
                at flash.events::EventDispatcher/dispatchEvent()
                at flash.net::URLLoader/onComplete()
            ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
                at flash.display::DisplayObjectContainer/removeChild()
                at Slideshow/startShow()
                at Slideshow/onComplete()

             

            TIA,

            beno

            • 3. Re: Error 1136
              kglad Adobe Community Professional & MVP

              what's ss()?

              • 4. Re: Error 1136
                beno12345 Level 1

                From your previous post...

                 

                var ss:Slideshow = new Slideshow();

                 

                Please reference my last post from there.

                TIA,

                beno

                • 5. Re: Error 1136
                  kglad Adobe Community Professional & MVP

                  i don't see ss() anywhere in my post.  i see ss.

                   

                  you added parantheses which should cause that error.

                   

                  you must know to use the "new" constructor to create movieclips etc in as3, don't you?  this is the same.

                  • 6. Re: Error 1136
                    beno12345 Level 1

                    OK, so starting all over again, this is what I now have:

                     

                    var slideshow:Slideshow = new Slideshow();
                    ...
                    slideshow;

                     

                    throws this error:

                     

                    TypeError: Error #1009: Cannot access a property or method of a null object reference.
                        at Slideshow/loadImages()
                        at Slideshow/processXML()
                        at flash.events::EventDispatcher/dispatchEventFunction()
                        at flash.events::EventDispatcher/dispatchEvent()
                        at flash.net::URLLoader/onComplete()
                    ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
                        at flash.display::DisplayObjectContainer/removeChild()
                        at Slideshow/startShow()
                        at Slideshow/onComplete()

                     


                    Now, if I try this:
                    var slideshow:Slideshow = new Slideshow();
                    ...
                    slideshow();

                     

                    I get this error;

                     

                    E:\DeJongh\DeJonghMain.as, Line 86    1180: Call to a possibly undefined method slideshow.

                     

                    Now, what I'm trying to do is get slideshow to show up on stage. If I run it by itself without importing it, everything works. How do I get it to import and display?

                     

                    TIA,
                    beno
                    • 7. Re: Error 1136
                      kglad Adobe Community Professional & MVP

                      you need to debug your Slideshow class.   i don't know anything about it.

                      • 8. Re: Error 1136
                        beno12345 Level 1

                        Well, now no errors are thrown; however, it doesn't show up in the imported movie! I thought it might

                        be something to do with the x and y coordinates of the imported instance, so I manipulated that without any

                        luck. I've supplied the code if you want to take a look.

                        beno

                         

                        package  {
                            import flash.display.MovieClip;
                            import flash.events.Event;
                            import flash.events.TimerEvent;
                            import flash.display.Sprite;
                            import flash.text.TextField;
                            import flash.utils.Timer;
                            import flash.net.URLLoader;
                            import flash.display.Loader;
                            import flash.net.URLRequest;
                            import flash.text.TextFieldAutoSize;
                            import flash.display.LoaderInfo;
                            import fl.transitions.*;
                            import fl.transitions.easing.Strong;
                           
                            [SWF(backgroundColor="0xffffff", width="400", height="800")]
                           
                            public class Slideshow extends MovieClip {
                                var my_speed:Number;
                                var my_total:Number;
                                var my_images:XMLList;
                                var my_loaders_array:Array=[];
                                var my_labels_array:Array=[];
                                var my_success_counter:Number=0;
                                var my_playback_counter:Number=0;
                                var my_slideshow:Sprite = new Sprite();
                                var my_image_slides:Sprite = new Sprite();
                                var my_label_slides:Sprite = new Sprite();
                                var my_preloader:TextField;
                                var my_timer:Timer;
                                var my_prev_tween:Tween;
                                var my_tweens_array:Array=[];
                                var my_xml_loader:URLLoader = new URLLoader();
                                var square:Sprite = new Sprite();
                                var slideshowWidth:int = new int(1008);
                                var slideshowHeight:int = new int(584);

                         

                                public function Slideshow() {
                                    my_xml_loader.load(new URLRequest("slideshow.xml"));
                                    my_xml_loader.addEventListener(Event.COMPLETE, processXML);
                                }
                               
                                function processXML(e:Event):void {
                                    var my_xml:XML=new XML(e.target.data);
                                    my_speed=my_xml.@SPEED;
                                    my_images=my_xml.IMAGE;
                                    my_total=my_images.length();
                                    loadImages();
                                    my_xml_loader.removeEventListener(Event.COMPLETE, processXML);
                                    my_xml_loader=null;
                                }

                         

                                function loadImages():void {
                                    for (var i:Number = 0; i < my_total; i++) {
                                        var my_url:String=my_images[i].@URL;
                                        var my_loader:Loader = new Loader();
                                        my_loader.load(new URLRequest(my_url));
                                        my_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
                                        my_loaders_array.push(my_loader);
                                        var my_label:TextField = new TextField();
                                        my_label.text=my_images[i].@TITLE;
                                        my_label.autoSize=TextFieldAutoSize.LEFT;
                                        my_labels_array.push(my_label);
                                    }
                                    my_preloader = new TextField();
                                    my_preloader.text="Loading";
                                    my_preloader.autoSize=TextFieldAutoSize.CENTER;
                                    my_preloader.x = (slideshowWidth - my_preloader.width)/2;
                                    my_preloader.y = (slideshowHeight - my_preloader.height)/2;
                                    addChild(my_preloader);
                                }

                         

                                function onComplete(e:Event):void {
                                    my_success_counter++;
                                    if (my_success_counter==my_total) {
                                        startShow();
                                    }
                                    var my_loaderInfo:LoaderInfo=LoaderInfo(e.target);
                                    my_loaderInfo.removeEventListener(Event.COMPLETE, onComplete);
                                }

                         

                                function startShow():void {
                                    removeChild(my_preloader);
                                    my_preloader=null;
                                    addChild(my_slideshow);
                                    my_slideshow.addChild(my_image_slides);
                                    my_slideshow.addChild(my_label_slides);
                                    my_slideshow.addChild(square);
                                    nextImage();
                                    my_timer=new Timer(my_speed*1000);
                                    my_timer.addEventListener(TimerEvent.TIMER, timerListener);
                                    my_timer.start();
                                }

                         

                                function nextImage():void {
                                    var my_image:Loader=Loader(my_loaders_array[my_playback_counter]);
                                    my_image.x = (slideshowWidth - my_image.width)/2;
                                    my_image.y = (slideshowHeight - my_image.height)/2;
                                    my_tweens_array[0]=new Tween(my_image,"alpha",Strong.easeOut,0,1,1,true);
                                    my_image_slides.addChild(my_image);
                                    square.graphics.clear();
                                    square.graphics.beginFill(0x000000);
                                    square.graphics.drawRect(0, my_image.height - 40, my_image.width, 40);
                                    square.graphics.endFill();
                                    square.alpha = .5;
                                    square.x = my_image.x;
                                    square.y = my_image.y;
                                    var my_label:TextField=new TextField();
                                    my_label.htmlText='<b>' + my_labels_array[my_playback_counter].text + '</b>';
                                    my_label.textColor = 0xffffff;
                                    my_label_slides.addChild(my_label);
                                    my_label.x=my_image.x + 10;
                                    my_label.y=my_image.y+my_image.height - 25;
                                    my_tweens_array[1]=new Tween(my_label,"alpha",Strong.easeOut,0,1,1,true);
                                }

                         

                                function timerListener(e:TimerEvent):void {
                                    hidePrev();
                                    my_playback_counter++;
                                    if (my_playback_counter==my_total) {
                                        my_playback_counter=0;
                                    }
                                    nextImage();
                                }

                         

                                function hidePrev():void {
                                    var my_image:Loader=Loader(my_image_slides.getChildAt(0));
                                    my_prev_tween=new Tween(my_image,"alpha",Strong.easeOut,1,0,1,true);
                                    my_prev_tween.addEventListener(TweenEvent.MOTION_FINISH, onFadeOut);
                                    var my_label:TextField=TextField(my_label_slides.getChildAt(0));
                                    my_tweens_array[2]=new Tween(my_label,"alpha",Strong.easeOut,1,0,1,true);
                                }

                         

                                function onFadeOut(e:TweenEvent):void {
                                    my_image_slides.removeChildAt(0);
                                    my_label_slides.removeChildAt(0);
                                }
                            }
                        }

                        • 9. Re: Error 1136
                          kglad Adobe Community Professional & MVP

                          did you add ss to your display list:

                           

                          var ss:etc...

                           

                          addChild(ss);

                          • 10. Re: Error 1136
                            beno12345 Level 1

                            Oops <:-}

                            Thanks,

                            beno

                            • 11. Re: Error 1136
                              kglad Adobe Community Professional & MVP

                              is there some reason you never mark an answer as helpful or as the correct answer?

                              • 12. Re: Error 1136
                                beno12345 Level 1

                                Sorry. Didn't notice it <:-} Checked

                                beno

                                • 13. Re: Error 1136
                                  kglad Adobe Community Professional & MVP

                                  thank you.

                                   

                                  (many of us that help on the adobe forums take pride in being recognized as supplying a correct or helpful answer and being recognized for that.)