A Flash Developer Resource Site

Results 1 to 14 of 14

Thread: movieclip not having onrelease function

  1. #1
    Senior Member
    Join Date
    Apr 2009
    Posts
    117

    movieclip not having onrelease function

    the movieclip named thmbs is not having working for the onRelease
    function.

    Code:
    _root.createEmptyMovieClip("thmbla", _root.getNextHighestDepth());
    thmbla._x = 250;
    thmbla._y = 50;
    
    _root.thmbla.createEmptyMovieClip("thmbs" + 1, thmblist.getNextHighestDepth());
    			var cLoader:MovieClipLoader = new MovieClipLoader();
    					
    			cLoader.loadClip("d:/testcode/small/1.png", _root.thmbla["thmbs" + 1]);
    					
    			_root.thmbla["thmbs" + (1)].onRelease = function()
    				{
    					trace("created");
    				}

  2. #2
    Senior Member
    Join Date
    Apr 2009
    Posts
    117
    this is the code

    Code:
    _root.createEmptyMovieClip("thmbla", _root.getNextHighestDepth());
    thmbla._x = 250;
    thmbla._y = 50;
    
    for(i=0;i<5;i++){
    _root.thmbla.createEmptyMovieClip("thmbs" + i, thmbla.getNextHighestDepth());
    			var cLoader:MovieClipLoader = new MovieClipLoader();
    					
    			cLoader.loadClip("d:/testcode/small/1.png", _root.thmbla["thmbs" + i]);
    					
    			_root.thmbla["thmbs" + i].onRelease = function()
    				{
    					trace("created");
    				}
    				
    }

  3. #3
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Not sure what you are trying to do, that code just puts 5 images on top of each other?

  4. #4
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Going from your original post this is using the full movieClipLoader process
    PHP Code:
    _root.createEmptyMovieClip("thmbla",_root.getNextHighestDepth());
    thmbla._x 250;
    thmbla._y 50;

    _root.thmbla.createEmptyMovieClip("thmbs",0);
    // create clip loader
    cLoader = new MovieClipLoader();
    mycLoader = new Object();
    cLoader.addListener(mycLoader);
    // load clip
    cLoader.loadClip("d:/testcode/small/1.png",_root.thmbla.thmbs);
    // clip starts
    cLoader.onLoadStart = function()
    {
        
    _root.thmbla.thmbs._visible false;
    };
    // clip progress
    cLoader.onLoadProgress = function()
    {
        
    _root.thmbla.thmbs._visible false;
    };
    // clip completes
    cLoader.onLoadComplete = function()
    {
        
    _root.thmbla.thmbs._visible false;
    };
    // clip instigate other things
    cLoader.onLoadInit = function()
    {
        
    _root.thmbla.thmbs._visible true;
        
    Initiate();
    };
    // make button work
    function Initiate()
    {
        
    _root.thmbla.thmbs.onPress = function()
        {
            
    trace(this._name);
        };

    with the movieClipLoader it needs to be fully loaded before you can assign anything to it.

    my hobby
    Last edited by fruitbeard; 01-20-2013 at 07:37 AM.

  5. #5
    Senior Member
    Join Date
    Apr 2009
    Posts
    117
    this is what i did

    Code:
    _root.createEmptyMovieClip("thmbla", _root.getNextHighestDepth());
    thmbla._x = 250;
    thmbla._y = 50;
    
    for(i=0;i<5;i++){
    _root.thmbla.createEmptyMovieClip("thmbs" + i, thmbla.getNextHighestDepth());
    			var cLoader:MovieClipLoader = new MovieClipLoader();
    					mycLoader = new Object();
    					cLoader.addListener(mycLoader);
    			cLoader.loadClip("d:/testcode/small/1.png", _root.thmbla["thmbs" + i]);
    			
    			mycLoader.onLoadStart = function()
    			{
    				_root.thmbla.thmbs._visible = false;
    			};
    			// clip progress
    			mycLoader.onLoadProgress = function()
    			{
    				_root.thmbla.thmbs._visible = false;
    			};
    			// clip completes
    			mycLoader.onLoadComplete = function()
    			{
    				_root.thmbla.thmbs._visible = false;
    			};
    			// clip instigate other things
    			mycLoader.onLoadInit = function(){
    				_root.thmbla.thmbs._visible = true;
    				initiate();
    			}
        
    			function Initiate()
    	{
    		_root.thmbla.thmbs.onPress = function()
    		{
    			trace("created");
    		};
    	}  
    }
    on press doesn't work pl note that i want each thmbs movieclip created within main movieclip thmbla to work as button and trace msg when clicked

  6. #6
    Senior Member
    Join Date
    Apr 2009
    Posts
    117
    when i use cloader.onLoadInit or other functions it gives me error "there is no property with the name 'onloadinit'"

  7. #7
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Firstly you rearranged the code and mycloader will not work as it is cloader, anyway, i'm feeling generous so here is the code to play around with, yes it works.
    PHP Code:
    var NumberRequired 5;
    var 
    Divide 1;
    var 
    Gap 1;

    _root.createEmptyMovieClip("thmbla",_root.getNextHighestDepth());
    thmbla._x 250;
    thmbla._y 50;

    cLoader = new MovieClipLoader();
    mycLoader = new Object();
    cLoader.addListener(mycLoader);

    for (var 
    0NumberRequireds++)
    {
        
    _root.thmbla.createEmptyMovieClip("thmbs" s,s);
        
    trace(_root.thmbla["thmbs" s] + " @ Depth: " _root.thmbla["thmbs" s].getDepth());
        if (
    >= NumberRequired 1)
        {
            
    0;
            
    cLoader.loadClip("d:/testcode/small/1.png",_root.thmbla["thmbs" i]);
            
    trace("Begin Loader Loop");
        }
    }

    cLoader.onLoadStart = function()
    {
        
    _root.thmbla["thmbs" i]._visible false;
    };
    cLoader.onLoadProgress = function()
    {
        
    _root.thmbla["thmbs" i]._visible false;
    };
    cLoader.onLoadComplete = function()
    {
        
    _root.thmbla["thmbs" i]._visible false;
    };
    cLoader.onLoadInit = function()
    {
        if (
    NumberRequired 1)
        {
            
    i++;
            
    cLoader.loadClip("d:/testcode/small/1.png",_root.thmbla["thmbs" i]);
        }
        else
        {
            
    Initiate();
        }
    };

    function 
    Initiate()
    {
        for (var 
    0NumberRequiredj++)
        {
            
    _root.thmbla["thmbs" j]._visible true;
            
    _root.thmbla["thmbs" j].forceSmoothing true;
            
    _root.thmbla["thmbs" j]._y Math.floor(Divide) * (_root.thmbla["thmbs" j]._height Gap);
            
    _root.thmbla["thmbs" j]._x 0;
            
    _root.thmbla["thmbs" j].onPress = function()
            {
                
    trace(this);
            };
        }

    it is a sequential clip loader !!
    Last edited by fruitbeard; 01-20-2013 at 10:40 AM.

  8. #8
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    made with fruitbeards patented design ^

  9. #9
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Not quite sure where to use the code from Allo Bacon, or if it helps at all, perhaps he is just increasing his post count again!!

  10. #10
    Senior Member
    Join Date
    Apr 2009
    Posts
    117
    i tested the code as u made and it gives me error

    access of undefined property _root
    access of undefined property thmbla
    access of undefined property cloader
    access of undefined property mycloader

    i m attaching the fla Attachment 74049

  11. #11
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    After testing your fla, I see nothing wrong.

    I think you are publishing for AS3( I tried and got the errors) and not AS2 as is my coding, the other possibility is the image paths, but that is entirely relative to your situation so not really an issue.

    I hope anybody else, can concur perhaps.

  12. #12
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    I can do what I want and who really cares about post count, id take off the number if I could

  13. #13
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Yes you can do what you desire Alloy, but it's probably better to start a new thread rather than hijack another persons with garbage comments.
    I'd personally love to see you helping somebody else with a bit of script.

  14. #14
    Senior Member
    Join Date
    Apr 2009
    Posts
    117
    thanx fruitbeard it works !!

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