Flash CS3 - Flash CS4

Free tutorials and scripts for all.
Actionscript 3.0

AddChild adding Class but not internal shapes

This is a discussion on AddChild adding Class but not internal shapes within the advanced Actionscript 3.0 forums, part of the Flash CS3 eng category; Hi Friends I am presently developing a site completely class based. N I am facing a problem . There were so ...


Go Back   Forum Flash CS3 Flash CS4 > English Forums > Flash CS3 eng > advanced Actionscript 3.0

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-07-08, 13:14
chiru's Avatar
Junior Member
 
Join Date: Jul 2008
Posts: 2
Rep Power: 0
chiru is on a distinguished road
AddChild adding Class but not internal shapes

Hi Friends
I am presently developing a site completely class based. N
I am facing a problem .
There were so many addchild (to attach them to stage at runtime) clips in the library.
I dont want them to be exported over the first frame so in the LINKAGE PROPERTIES i am unchecking the export in the first frame option and I am using a base class for them which again exteds Display.MovieClip class [it must be].
Further In the Publish Settings under ACTION SCRIPT 3.0 settings I have changed the export class in frame to 2 so the Frame 1 of teh movie will be free from classes and Objects so a simple preloader can be put which will display start from the 0 or may little bit of 5 percent till 100.
If if activate The export in the first frame then the Frame 1 will become 50% of the movie and my preloader will start from 50 i.e. after completely loading the Frame 1.

But the problem is I have Unchecked and freed the Frame 1 size but the MovieClip objects are not getting added at the run time. But I am sure that the class Which I have created is attaching but not the internal objects.

I have created a main.fla and in it's library i have a symbol which was exported for action script.

my movie has two frame 1 & 2,
Code in Frame 1
Code:
stop();
this.addEventListener(Event.ENTER_FRAME, per);
function per(ev:Event):void {
   if (this.loaderInfo.bytesLoaded == this.loaderInfo.bytesTotal) {
      this.removeEventListener(Event.ENTER_FRAME, per);
      this.gotoAndPlay(2);
   }
}
Code in Frame 2
Code:
trace("hellow world frame >> " + this.currentFrame);
var mcc:mcClip= new mcClip();
this.addChild(mcc);
stop();
Next I have created the BaseClass mcClip.
Code:
package {
   import flash.display.MovieClip;
   public class mcClip extends MovieClip {
      public function mcClip() {
         trace(this);
      }
   }
}
Class name mc
base class mcClip. // this class will extend the Display.movieClip class so no problem at all. [this i have doe because the same class can be used for multiple objects in the library.]
Unchecked Export in frist frame

while runnign teh move the class is adding but teh graphic shape which i have drawn in the library movielicp is not attaching to the stage.

I am not getting what happening here.
the library movie clip is not attaching but its base class is attaching and it is tracing the class.

I hope you got the problem what I have.

Please any body who read it dont ignore it
Thanks in Advance.
I will be great full to you
Attached Files
File Type: zip addchild2.zip (6.4 KB, 2 views)

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #2 (permalink)  
Old 10-07-08, 04:28
xInstinct's Avatar
Flasher
 
Join Date: Jun 2008
Location: Texas
Posts: 42
Rep Power: 0
xInstinct is on a distinguished road
Send a message via AIM to xInstinct
Re: AddChild adding Class but not internal shapes

Hi Chiru,

I had a look at your files and such, and it really confused me! haha
Something is messing up... which you know...
because in the Document Class, with the trace(this) it definitely finds the [Object]
So it should be there, but you baffled me at the moment...

I will have to look into it further, but idk how much I can help

xInstinct
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #3 (permalink)  
Old 10-07-08, 18:42
chiru's Avatar
Junior Member
 
Join Date: Jul 2008
Posts: 2
Rep Power: 0
chiru is on a distinguished road
Re: AddChild adding Class but not internal shapes

Thanks for your interest in Helping me.

Simply What I need all is ->

Attaching a Library Object to the stage at run time with out exporting it in the first frame. Just as we do it in Flash 8.
So the size of the first frame will not effect to play the pre-loader. This is very much successful in Flash 8.

LIKE :::
1. create MC in library.
2. Un-check it to not export in 1st frame.
3. Drag it in the Time line after Frame 1 supposed 2 and out of the stage.
4. Then They can be accessed at any time using AttachMovie.

But the same is not working in CS3 Flash.

1. We have classes and Base Classes.
2. We need to call it using its class name not identifier.
3. Even If we drag it in the second frame and call method ADD CHILD it is not adding the MC and Not even Throwing any error.
4. So I have tried creating a simple class and Traced it.
5. Amazingly the class is getting Added. So the trace is calling.
6. Even if we doesn't create a Class Flash by default will create the same class. That is why I have Created to trace whether the calss is getting added or not. ITS ADDING.
7. That is all I have got and FINALLY my condition is [I think you understood.]

Now I omitted many good programming techniques and developing my present Project in a nut simple even I am completely developing it in Classes.


__________________

===========================================

==
I AM INVINCIBLE STILL SOMETIMES I NEED YOUR HELP.
==
I AM BAD ? I AM DEAD : I AM YOURS ;
===========================================
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads

Thread Thread Starter Forum Replies Last Post
Actionscript 3 Adding sub's to my horizontal xml menu slabbetje advanced Actionscript 3.0 1 15-11-08 10:02
Dynamically adding a method to an Object with Actionscript 3.0 Flep Tutorials 0 14-10-08 06:26
adding an eventListener to an Object in a For Loop guitarman Flash CS3 eng 2 31-01-08 05:04
Positioning shapes using a loop Flep Tutorials 3 10-11-07 09:14
Posizionare delle shapes utilizzando un ciclo Flep Articoli e tutorials 0 20-09-07 17:20


All times are GMT. The time now is 22:02.


Powered by vBulletin versione 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC4
Forum SiteMap


FlepStudio
by Filippo Lughi
P.IVA 03605860406