Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   ActionScript 1.0/2.0 (http://www.flasher.ru/forum/forumdisplay.php?f=93)
-   -   копия movieClipa (http://www.flasher.ru/forum/showthread.php?t=100160)

telit 21.08.2007 11:49

копия movieClipa
 
Код:

_root.createEmptyMovieClip("menu_mc", _root.getNextHighestDepth());
_root["menu_mc"].createEmptyMovieClip("mc_2", _root["menu_mc"].getNextHighestDepth());
_root["menu_mc"]["mc_2"].loadMovie("hair.swf");
_root["menu_mc"].createEmptyMovieClip("mc_1", _root["menu_mc"].getNextHighestDepth());

with (_root["menu_mc"]["mc_1"]){
    lineStyle(1, 0xCCCCCC);
    beginFill(0x4827CF);
    moveTo(0, 0);
    lineTo(80, 0);
    lineTo(80, 60);
    lineTo(0, 60);
    lineTo(0, 0);
    endFill();
}
   
_root["menu_mc"]["mc_1"].onPress = function() {
  dup(this);
}

_root["menu_mc"]["mc_1"].onRelease = _root["menu_mc"]["mc_1"].onReleaseOutside = function() {
removeMovieClip(f_mc);
}

dup = function(m_mc:MovieClip){
        duplicateMovieClip(m_mc, "f_mc", _root.getNextHighestDepth());
        f_mc.startDrag();
        trace(_root["f_mc"]);//undefined
        trace(f_mc);//undefined

}

почему не работает?
PS все делать в _root не предлагать ;)

KPOT 21.08.2007 12:32

Код:

this.createEmptyMovieClip("menu_mc", this.getNextHighestDepth());
this["menu_mc"].createEmptyMovieClip("mc_2", this["menu_mc"].getNextHighestDepth());
this["menu_mc"]["mc_2"].loadMovie("hair.swf");
this["menu_mc"].createEmptyMovieClip("mc_1", this["menu_mc"].getNextHighestDepth());

with (this["menu_mc"]["mc_1"]){
    lineStyle(1, 0xCCCCCC);
    beginFill(0x4827CF);
    moveTo(0, 0);
    lineTo(80, 0);
    lineTo(80, 60);
    lineTo(0, 60);
    lineTo(0, 0);
    endFill();
}
   
this["menu_mc"]["mc_1"].onPress = processPressClip;

this["menu_mc"]["mc_1"].onRelease = this["menu_mc"]["mc_1"].onReleaseOutside = function()
{
//removeMovieClip(this);
}

var currentTarget:MovieClip;

function dup(m_mc:MovieClip)
{
        var nextDepth:Number = this["menu_mc"].getNextHighestDepth();
        m_mc.duplicateMovieClip("f_mc"+nextDepth, nextDepth);
       
        var duppedClip:MovieClip = this["menu_mc"]["f_mc"+nextDepth];
       
        currentTarget = duppedClip;
       
        duppedClip.onPress = processPressClip;
        duppedClip.onRelease = processReleaseClip;
       
        duppedClip.startDrag();
}

this.onMouseUp = function()
{
        if(currentTarget != null)
       
        currentTarget.stopDrag();
        currentTarget = null;
}

function processReleaseClip()
{
        this.stopDrag();       
}

function processPressClip()
{
        this._parent._parent.dup(this);
}

немного модифицировал, думаю разберёшся что к чему

telit 21.08.2007 16:42

Код:

function thumbnails_fn_r(kr) {
        r_menu.createEmptyMovieClip("t"+kr, r_menu.getNextHighestDepth());
        tlistener_r = new Object();
        tlistener_r.onLoadInit = function(target_mc_r) {
                if ((kr%2)!=0) {
                target_mc_r._y = hit_top._y+(128-60)*(kr-1);
                target_mc_r._x = 140;
                } else {
                        target_mc_r._y = hit_top._y+(128-60)*kr;
                }
                target_mc_r._xscale = target_mc_r._yscale = 50;
                target_mc_r.pictureValue_r = kr;
               
                target_mc_r.onRollOver = function() {
                        this._alpha = 50;
                        //if (_root.flagPress == 0)
                        thumbNailScroller_r();
                };
                target_mc_r.onRollOut = function() {
                        this._alpha = 100;
                };
               
                target_mc_r.onPress = processPressClip;
        };
        image_mcl_r = new MovieClipLoader();
        image_mcl_r.addListener(tlistener_r);
        image_mcl_r.loadClip(thumbnails_r[kr], "r_menu.t"+kr);
}



var currentTarget:MovieClip;

function dup(m_mc:MovieClip)
{
        var nextDepth:Number = _root.r_menu.getNextHighestDepth();
        m_mc.duplicateMovieClip("f_mc"+nextDepth, nextDepth);
       
        var duppedClip:MovieClip = _root.r_menu["f_mc"+nextDepth];
       
        currentTarget = duppedClip;
       
        duppedClip.onPress = processPressClip;
        duppedClip.onRelease = processReleaseClip;
       
        duppedClip.startDrag();
}

this.onMouseUp = function()
{
        if(currentTarget != null)
        {
        currentTarget.stopDrag();
        if (currentTarget.hitTest(_root.box)) trace("good");
        }
        //trace(currentTarget);
        removeMovieClip(currentTarget);
        currentTarget = null;
}

function processReleaseClip()
{
        this.stopDrag();       
}

function processPressClip()
{
        this._parent._parent.dup(this);
}

как исправить?


Часовой пояс GMT +4, время: 19:50.

Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.