A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: Scripts in cloned elements

  1. #1
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299

    Scripts in cloned elements

    Another thing I can't get running. I have a child movie with a script running every frame. I clone this child movie and place n of them on the screen. The script is running only once. I tried anything. Looping the movie, place the script into a scene etc.

    My movie is attached. The code is in TV_program/list/... it set the y coord of the movie to a textbox variable (text). But it don't update if you drag the items.

    Any suggestions?
    Attached Files Attached Files
    visit my homepage -> ejected.de

  2. #2
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    the script which sets the 'text' varibale for the editbox can be found in movie 'listItem_TV'
    visit my homepage -> ejected.de

  3. #3
    I looked at it, but I can't follow the program, in fact I can't even find the cloning script. Can you simplify the example and cut it down to just a simple clone?

  4. #4
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    It's all about the childmovie 'tv_program'. In there you find another childmovie called 'list'. In there you will find a script in Scene 1. This script is cloning the element 'listitem_TV' and works well.

    Now browse deeper into childmovie 'listitem_TV', which is the element to clone. You will find a script in Scene 1. This script is in every cloned element and should be executed every loop. This really simple script should set the textbox assigned variable 'text' to the Y coordinate of this element (this.y). This is just for debugging purposes.

    The problem is that the script in the cloned element only runs once and only gets the Y coordinate once. But why?
    visit my homepage -> ejected.de

  5. #5
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    ok. I cutted it down...
    Attached Files Attached Files
    visit my homepage -> ejected.de

  6. #6
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    Can someone approve that scripts in cloned elements are working as aspected? Thank you.
    visit my homepage -> ejected.de

  7. #7
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    This is so much frustrating. Can't figure it out. The scripts in my cloned elements are only running once. Sitting here for hours of testing with no success.
    visit my homepage -> ejected.de

  8. #8
    Senior Member
    Join Date
    Dec 2006
    Posts
    274
    It is hard to debug these kind of movies as scripts are all over elements, movies with child movies with child movies makes debugging also mess
    As 3dfa is moving strongly to action script 3 it could be better to move as3 style and place all codes in same place.. I know it is not easy to change coding style but in long run it could be best bet...

  9. #9
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    OK. I'm ready for AS3.
    Please let me know if you can give me a direction to go. Maybe you know a good tutorial to learn differences between AS2 & 3?

    I'm using 3dfa for years and now I'm confused. If I switch my project to Flash9, nothing work anymore.
    visit my homepage -> ejected.de

  10. #10
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    And my next question. If you say you place all code into the same place (Movie script I think), how do you make it possible to have instances of the same script in clones where each script can access the cloned movie.

    Say you have a childmovie "myChild" with a textbox and a script in it. The script in "myChild" will set the textbox value to this.y. How do you do this with AS3? You can set the value from outside "myChild", but you will have a FOR loop which cycle through every child. Say you have hundrets of clones of myChild, you will have a loop which is running hundret times. If you take a simple script (var text = this.y) and nest this into the clone it is much easer und faster to code. And this have no dependecies to your main code.

    Do you understand what I'm thinking of?
    I'm just confused how to make things possible with AS3. Puh!
    visit my homepage -> ejected.de

  11. #11
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    I'm totaly confused. With the new version of 3dfa I can't get things running anymore. Sometime code is working and sometimes not.

    Why still use .clone() and not using same code as AS3 with instances of objects? Really confusing.

    Never got cloning with flash9 running like it should. Just the sample is working. For me it is working only with flash8.

    And what is about addChild? This is a must have. How to add cloned elements into another movie than the parent movie? Can't find any workaround for this.

    I think it's time to fully implement as3 instances and a object library like in Flash 9.
    visit my homepage -> ejected.de

  12. #12
    Senior Member kusco's Avatar
    Join Date
    Nov 2001
    Posts
    681
    There have been a number of unexpected delays, and the next version of 3DFA will be released in a few days.

    The cloning function does use the addChild function when exporting to Flash 9. You can see the technique used by 3DFA by examining the source code that 3DFA generates. However, it is not difficult to write your own code to perform the cloning of an element.
    Cheers,
    kusco
    (3DFA Support Team)

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