Provlhma me actionscript

Λύσεις προβλημάτων για το δημοφιλές πρόγραμμα κατασκευής παρουσιάσεων στο διαδίκτυο.

Συντονιστές: WebDev Moderators, Super-Moderators

Απάντηση
Άβαταρ μέλους
fafos
Script Master
Δημοσιεύσεις: 6231
Εγγραφή: 30 Νοέμ 2004 03:09

Provlhma me actionscript

Δημοσίευση από fafos » 22 Σεπ 2007 22:40

Exo to parakato actionscript:

Κώδικας: Επιλογή όλων

function init()
{
    thumb_mc._visible = false;
    error_mc._visible = false;
    filename = "file/video/latestscrollers.php";
    title_mc.content_txt.text = _root.t == undefined ? "Latest  Videos..." : unescape(_root.t);
    home_mc = this;
    startDepth = 1000;
    colMax = 5;
    rowCurrent = 0;
    tCurrent = 0;
    tHideTime = 75;
    rowTimeShown = 8000;
    rowMaxDisplayed = 36;
    userInteracting = false;
    trackMarginTop = 10;
    trackMarginBottom = 5;
    trackMarginSide = 10;
    trackSideLeft = trackMarginSide;
    trackSideRight = Stage.width - trackMarginSide;
    trackSideTop = trackMarginTop;
    trackSideBottom = Stage.height - trackMarginBottom;
    trackXRange = Stage.width - trackMarginSide * 2;
    trackSpacing = trackXRange / colMax;
    info = new Array();
    pos = new Object();
    pos.startP = 0.83;
    pos.startX = new Array();
    pos.startY = vanish_mc._y + (showline_mc._y - vanish_mc._y) * pos.startP;
    pos.showP = 0.95;
    pos.showX = new Array();
    pos.showY = showline_mc._y;
    pos.showMargin = 6;
    pos.showCtr = (Stage.width - thumb_mc._width - pos.showMargin * 2) / (colMax - 1);
    pos.showTime = 12;
    pos.finalP = 1.3;
    pos.finalX = new Array();
    pos.finalY = vanish_mc._y + (showline_mc._y - vanish_mc._y) * pos.finalP;
    pos.finalTime = 35;
    pos.rollOverTime = 4;
    pos.startToShowX = new Object();
    pos.startToShowY = new Object();
    pos.startToShowP = new Object();
    fader_mc._alpha = 0;
    fader_mc.swapDepths(4999);
    progress_mc.swapDepths(5001);
    title_mc.swapDepths(5002);
    showline_mc._visible = false;
    home_mc.createEmptyMovieClip("lines_mc", 1);
    lines_mc._visible = false;
    lines_mc.lineStyle(0, 16711935, 100);
    var __reg3 = 0;
    while &#40;__reg3 < colMax&#41; 
    &#123;
        pos.showX&#91;__reg3&#93; = pos.showMargin + thumb_mc._width / 2 + pos.showCtr * __reg3;
        pos.startX&#91;__reg3&#93; = pos.showX&#91;__reg3&#93; + &#40;vanish_mc._x - pos.showX&#91;__reg3&#93;&#41; * &#40;1 - pos.startP&#41;;
        pos.finalX&#91;__reg3&#93; = pos.showX&#91;__reg3&#93; + &#40;vanish_mc._x - pos.showX&#91;__reg3&#93;&#41; * &#40;1 - pos.finalP&#41;;
        lines_mc.moveTo&#40;vanish_mc._x, vanish_mc._y&#41;;
        lines_mc.lineTo&#40;pos.showX&#91;__reg3&#93;, pos.showY&#41;;
        pos.startToShowX&#91;"col" + __reg3&#93; = new Array&#40;&#41;;
        pos.startToShowY&#91;"col" + __reg3&#93; = new Array&#40;&#41;;
        pos.startToShowP&#91;"col" + __reg3&#93; = new Array&#40;&#41;;
        var __reg4 = 0;
        while &#40;__reg4 <= pos.showTime&#41; 
        &#123;
            pos.startToShowX&#91;"col" + __reg3&#93;&#91;__reg4&#93; = easeIn&#40;__reg4, pos.startX&#91;__reg3&#93;, pos.showX&#91;__reg3&#93; - pos.startX&#91;__reg3&#93;, pos.showTime&#41;;
            pos.startToShowY&#91;"col" + __reg3&#93;&#91;__reg4&#93; = easeIn&#40;__reg4, pos.startY, pos.showY - pos.startY, pos.showTime&#41;;
            pos.startToShowP&#91;"col" + __reg3&#93;&#91;__reg4&#93; = easeIn&#40;__reg4, pos.startP, pos.showP - pos.startP, pos.showTime&#41; * 100;
            ++__reg4;
        &#125;

        ++__reg3;
    &#125;

    intImgLoading&#40;&#41;;
    loadXML&#40;filename&#41;;
&#125;

function hideProgress&#40;&#41;
&#123;
    progress_mc.onEnterFrame = function &#40;&#41;
    &#123;
        this._alpha = this._alpha - 25;
        this._xscale = this._xscale + 10;
        this._yscale = this._yscale + 10;
        this._y = this._y + 7;
        if &#40;this._alpha <= 0&#41; 
        &#123;
            progress_mc.stop&#40;&#41;;
            progrees_mc._visible = false;
            this.onEnterFrame = function &#40;&#41;
            &#123;
            &#125;
            ;
        &#125;

    &#125;
    ;
&#125;

function easeIn&#40;t, b, c, d&#41;
&#123;
    return c * &#40;t = t / d&#41; * t * t * t + b;
&#125;

function easeOut&#40;t, b, c, d&#41;
&#123;
    return &#40;0 - c&#41; * &#40;&#40;t = t / d - 1&#41; * t * t * t - 1&#41; + b;
&#125;

function onXMLLoaded&#40;&#41;
&#123;
    hideProgress&#40;&#41;;
    createNewRow&#40;rowCurrent&#41;;
    currentInterval = setInterval&#40;onShowNextRow, rowTimeShown&#41;;
&#125;

function onXMLError&#40;error_status&#41;
&#123;
    error_mc._visible = true;
    progress_mc._visible = false;
    progress_mc.stop&#40;&#41;;
&#125;

function onNewRowCreated&#40;row&#41;
&#123;
    home_mc.createEmptyMovieClip&#40;"loadChecker_mc", home_mc.getNextHighestDepth&#40;&#41;&#41;;
    home_mc.loadChecker_mc.onEnterFrame = function &#40;&#41;
    &#123;
        var __reg3 = true;
        var __reg2 = 0;
        while &#40;__reg2 < colMax&#41; 
        &#123;
            __reg3 = home_mc&#91;"thumb" + row + __reg2 + "_mc"&#93;.imgLoaded;
            ++__reg2;
        &#125;

        if &#40;__reg3&#41; 
        &#123;
            showThumbs&#40;row&#41;;
            this.onEnterFrame = function &#40;&#41;
            &#123;
            &#125;
            ;
        &#125;

    &#125;
    ;
&#125;

function onShowThumbs&#40;row&#41;
&#123;
    rowCurrent = row;
&#125;

function onHideThumbs&#40;row&#41;
&#123;
&#125;
;
function onShowNextRow&#40;&#41;
&#123;
    if &#40;rowCurrent >= rowMaxDisplayed&#41; 
    &#123;
        clearInterval&#40;currentInterval&#41;;
    &#125;

    if &#40;userInteracting&#41; 
    &#123;
        return;
    &#125;

    createNewRow&#40;rowCurrent + 1&#41;;
&#125;

function onThumbRollOver&#40;&#41;
&#123;
    home_mc.createEmptyMovieClip&#40;"mousetracker_mc", home_mc.getNextHighestDepth&#40;&#41;&#41;;
    home_mc.mousetracker_mc.current_mc = this;
    home_mc.mousetracker_mc.oldX = _xmouse;
    home_mc.mousetracker_mc.oldY = _ymouse;
    home_mc.mousetracker_mc.onEnterFrame = function &#40;&#41;
    &#123;
        if &#40;Math.round&#40;_xmouse&#41; == Math.round&#40;this.oldX&#41; && Math.round&#40;_ymouse&#41; == Math.round&#40;this.oldY&#41;&#41; 
        &#123;
            ++this.count;
            if &#40;this.count > tHideTime&#41; 
            &#123;
                this.current_mc.onRollOut&#40;&#41;;
                this.onEnterFrame = function &#40;&#41;
                &#123;
                &#125;
                ;
            &#125;

            return;
        &#125;

        this.count = 0;
        this.oldX = _xmouse;
        this.oldY = _ymouse;
    &#125;
    ;
    userInteracting = true;
    this.swapDepths&#40;5000&#41;;
    this.active = true;
    updateFadeThumbs&#40;this.row, this.col&#41;;
    this.count = 0;
    this.onEnterFrame = function &#40;&#41;
    &#123;
        if &#40;this._y < pos.showY + this.showIncY / 2 * pos.rollOverTime&#41; 
        &#123;
            this._x = this._x + this.showIncX / 2;
            this._y = this._y + this.showIncY / 2;
            this._xscale = this._xscale + this.showIncP / 2;
            this._yscale = this._yscale + this.showIncP / 2;
            this.hitArea_mc._yscale = this.hitArea_mc._yscale + 4;
        &#125;

        ++this.count;
        if &#40;this.count >= pos.rollOverTime&#41; 
        &#123;
            this.title_mc._visible = true;
            this.onEnterFrame = function &#40;&#41;
            &#123;
            &#125;
            ;
        &#125;

    &#125;
    ;
&#125;

function onThumbRollOut&#40;&#41;
&#123;
    userInteracting = false;
    this.active = false;
    this.title_mc._visible = false;
    updateFadeThumbs&#40;this.row, this.col&#41;;
    this.onEnterFrame = function &#40;&#41;
    &#123;
        this._x = this._x - this.showIncX / 2;
        this._y = this._y - this.showIncY / 2;
        this._xscale = this._xscale - this.showIncP / 2;
        this._yscale = this._yscale - this.showIncP / 2;
        this.hitArea_mc._yscale = this.hitArea_mc._yscale - 4;
        if &#40;this._y <= pos.showY&#41; 
        &#123;
            this._x = pos.showX&#91;this.col&#93;;
            this._y = pos.showY;
            this._xscale = pos.showP * 100;
            this._yscale = pos.showP * 100;
            this.onEnterFrame = function &#40;&#41;
            &#123;
            &#125;
            ;
        &#125;

    &#125;
    ;
&#125;

function onThumbRelease&#40;&#41;
&#123;
    getURL&#40;info&#91;this.infoID&#93;.url, ""&#41;;
&#125;

function loadXML&#40;filename&#41;
&#123;
    var data_xml = new XML&#40;&#41;;
    data_xml.ignoreWhite = true;
    data_xml.onLoad = function &#40;success&#41;
    &#123;
        if &#40;success&#41; 
        &#123;
            var __reg8 = data_xml.firstChild.firstChild.childNodes.length;
            var __reg5 = new Array&#40;&#41;;
            var __reg4 = new Array&#40;&#41;;
            var __reg7 = 0;
            while &#40;__reg7 < __reg8&#41; 
            &#123;
                __reg5.push&#40;__reg7&#41;;
                ++__reg7;
            &#125;

            __reg7 = 0;
            while &#40;__reg7 < __reg8&#41; 
            &#123;
                var __reg6 = Math.floor&#40;Math.random&#40;&#41; * __reg5.length&#41;;
                __reg4.push&#40;__reg5&#91;__reg6&#93;&#41;;
                __reg5.splice&#40;__reg6, 1&#41;;
                ++__reg7;
            &#125;

            var __reg3 = 0;
            var __reg2 = data_xml.firstChild.firstChild.firstChild;
            while &#40;__reg2 != null&#41; 
            &#123;
                info&#91;__reg4&#91;__reg3&#93;&#93; = new Array&#40;&#41;;
                var __reg1 = __reg2.firstChild;
                while &#40;__reg1 != null&#41; 
                &#123;
                    info&#91;__reg4&#91;__reg3&#93;&#93;&#91;__reg1.nodeName&#93; = __reg1.firstChild.nodeValue;
                    __reg1 = __reg1.nextSibling;
                &#125;

                ++__reg3;
                __reg2 = __reg2.nextSibling;
            &#125;

            if &#40;__reg3 == 0&#41; 
            &#123;
                onXMLError&#40;&#41;;
            &#125;
            else 
            &#123;
                onXMLLoaded&#40;&#41;;
            &#125;


            return;
        &#125;

        onXMLError&#40;data_xml.status&#41;;
    &#125;
    ;
    data_xml.load&#40;filename&#41;;
&#125;

function createNewRow&#40;row&#41;
&#123;
    var __reg2 = 0;
    while &#40;__reg2 < colMax&#41; 
    &#123;
        duplicateMovieClip&#40;"thumb_mc", "thumb" + row + __reg2 + "_mc", 16384 + startDepth--&#41;;
        var __reg1 = home_mc&#91;"thumb" + row + __reg2 + "_mc"&#93;;
        __reg1.title_mc._visible = false;
        loadThumbImg&#40;row, __reg2, info&#91;tCurrent&#93;.thumbnail_url&#41;;
        __reg1.infoID = tCurrent;
        __reg1.row = row;
        __reg1.col = __reg2;
        __reg1.showIncX = &#40;pos.showX&#91;__reg2&#93; - pos.startX&#91;__reg2&#93;&#41; / pos.showTime;
        __reg1.showIncY = &#40;pos.showY - pos.startY&#41; / pos.showTime;
        __reg1.showIncP = &#40;pos.showP - pos.startP&#41; * 100 / pos.showTime;
        __reg1.finalIncX = &#40;pos.finalX&#91;__reg2&#93; - pos.showX&#91;__reg2&#93;&#41; / pos.finalTime;
        __reg1.finalIncY = &#40;pos.finalY - pos.showY&#41; / pos.finalTime;
        __reg1.finalIncP = &#40;pos.finalP - pos.showP&#41; * 100 / pos.finalTime;
        __reg1._x = pos.startX&#91;__reg2&#93;;
        __reg1._y = pos.startY;
        __reg1._xscale = pos.startP * 100;
        __reg1._yscale = pos.startP * 100;
        __reg1.onRelease = onThumbRelease;
        __reg1.onRollOver = onThumbRollOver;
        __reg1.onRollOut = onThumbRollOut;
        __reg1.enabled = false;
        __reg1.title_mc.content_txt.text = info&#91;tCurrent&#93;.title;
        __reg1.overlay_mc.length_txt.text = info&#91;tCurrent&#93;.run_time;
        __reg1.overlay_mc.viewers_txt.text = info&#91;tCurrent&#93;.viewers;
        ++tCurrent;
        if &#40;tCurrent >= info.length&#41; 
        &#123;
            tCurrent = 0;
        &#125;

        ++__reg2;
    &#125;

    onNewRowCreated&#40;row&#41;;
&#125;

function showThumbs&#40;row&#41;
&#123;
    home_mc.createEmptyMovieClip&#40;"ctrlShow" + row + "_mc", this.getNextHighestDepth&#40;&#41;&#41;;
    if &#40;row > 0&#41; 
    &#123;
        hideThumbs&#40;row - 1&#41;;
    &#125;

    home_mc&#91;"ctrlShow" + row + "_mc"&#93;.timer = 0;
    home_mc&#91;"ctrlShow" + row + "_mc"&#93;.count = 0;
    home_mc&#91;"ctrlShow" + row + "_mc"&#93;.onEnterFrame = function &#40;&#41;
    &#123;
        if &#40;Math.floor&#40;this.timer / 3&#41; == this.timer / 3&#41; 
        &#123;
            var __reg2 = home_mc&#91;"thumb" + row + this.count + "_mc"&#93;;
            __reg2.count = 0;
            __reg2.onEnterFrame = function &#40;&#41;
            &#123;
                this._x = pos.startToShowX&#91;"col" + this.col&#93;&#91;this.count&#93;;
                this._y = pos.startToShowY&#91;"col" + this.col&#93;&#91;this.count&#93;;
                this._xscale = pos.startToShowP&#91;"col" + this.col&#93;&#91;this.count&#93;;
                this._yscale = this._xscale;
                ++this.count;
                if &#40;this.count > pos.showTime&#41; 
                &#123;
                    this.enabled = true;
                    this.onEnterFrame = function &#40;&#41;
                    &#123;
                    &#125;
                    ;
                &#125;

            &#125;
            ;
            __reg2.gotoAndPlay&#40;"show"&#41;;
            if &#40;this.count++ >= colMax&#41; 
            &#123;
                onShowThumbs&#40;row&#41;;
                this.onEnterFrame = function &#40;&#41;
                &#123;
                &#125;
                ;
            &#125;

        &#125;

        ++this.timer;
    &#125;
    ;
&#125;

function hideThumbs&#40;row&#41;
&#123;
    var __reg3 = 0;
    for &#40;;;&#41; 
    &#123;
        if &#40;__reg3 >= colMax&#41; 
        &#123;
            return;
        &#125;

        var __reg2 = home_mc&#91;"thumb" + row + __reg3 + "_mc"&#93;;
        __reg2.enabled = false;
        __reg2.count = 0;
        __reg2.onEnterFrame = function &#40;&#41;
        &#123;
            this._x = this._x + this.finalIncX;
            this._y = this._y + this.finalIncY;
            this._xscale = this._xscale + this.finalIncP;
            this._yscale = this._yscale + this.finalIncP;
            ++this.count;
            if &#40;this.count >= pos.finalTime&#41; 
            &#123;
                if &#40;this.col == 0&#41; 
                &#123;
                    killAllOldThumbs&#40;&#41;;
                &#125;

                this._visible = false;
                this.removeMovieClip&#40;&#41;;
                this.onEnterFrame = function &#40;&#41;
                &#123;
                &#125;
                ;
            &#125;

        &#125;
        ;
        __reg2.gotoAndPlay&#40;"hide"&#41;;
        ++__reg3;
    &#125;

&#125;

function killAllOldThumbs&#40;&#41;
&#123;
    var __reg3 = rowCurrent - 1;
    var __reg2 = 0;
    for &#40;;;&#41; 
    &#123;
        if &#40;__reg2 >= colMax&#41; 
        &#123;
            return;
        &#125;

        var __reg1 = home_mc&#91;"thumb" + __reg3 + __reg2 + "_mc"&#93;;
        if &#40;__reg1._x != undefined&#41; 
        &#123;
            __reg1.enabled = false;
            __reg1._visible = false;
            __reg1.removeMovieClip&#40;&#41;;
        &#125;

        ++__reg2;
    &#125;

&#125;

function updateFadeThumbs&#40;row, col&#41;
&#123;
    var __reg3 = false;
    var __reg2 = 0;
    while &#40;__reg2 < colMax&#41; 
    &#123;
        if &#40;home_mc&#91;"thumb" + row + __reg2 + "_mc"&#93;.active&#41; 
        &#123;
            __reg3 = true;
            break;
        &#125;

        ++__reg2;
    &#125;

    if &#40;__reg3&#41; 
    &#123;
        fader_mc.onEnterFrame = function &#40;&#41;
        &#123;
            if &#40;this._alpha <= 30&#41; 
            &#123;
                this._alpha = this._alpha + 5;
                return;
            &#125;

            this._alpha = 30;
            this.onEnterFrame = function &#40;&#41;
            &#123;
            &#125;
            ;
        &#125;
        ;
        return;
    &#125;

    fader_mc.count = 0;
    fader_mc.onEnterFrame = function &#40;&#41;
    &#123;
        if &#40;this._alpha > 5&#41; 
        &#123;
            if &#40;this.count > 5&#41; 
            &#123;
                this._alpha = this._alpha - 10;
            &#125;

        &#125;
        else 
        &#123;
            this._alpha = 0;
            this.onEnterFrame = function &#40;&#41;
            &#123;
            &#125;
            ;
        &#125;


        ++this.count;
    &#125;
    ;
&#125;

function intImgLoading&#40;&#41;
&#123;
    var __reg1 = new Object&#40;&#41;;
    __reg1.onLoadStart = function &#40;target_mc&#41;
    &#123;
    &#125;
    ;
    __reg1.onLoadComplete = function &#40;target_mc&#41;
    &#123;
    &#125;
    ;
    __reg1.onLoadError = function &#40;target_mc, errorCode, httpStatus&#41;
    &#123;
    &#125;
    ;
    __reg1.onLoadInit = function &#40;target_mc&#41;
    &#123;
        target_mc._xscale = &#40;home_mc.thumb_mc.main_mc._width - 4&#41; / target_mc._width * 100;
        target_mc._yscale = target_mc._xscale;
        target_mc._x = target_mc._width / -2;
        target_mc._y = 0 - target_mc._height;
        target_mc._parent._parent.imgLoaded = true;
    &#125;
    ;
    image_mcl = new MovieClipLoader&#40;&#41;;
    image_mcl.addListener&#40;__reg1&#41;;
&#125;

function loadThumbImg&#40;row, col, filename&#41;
&#123;
    var current_mc = home_mc&#91;"thumb" + row + col + "_mc"&#93;;
    current_mc.main_mc.createEmptyMovieClip&#40;"imgHolder_mc", current_mc.main_mc.getNextHighestDepth&#40;&#41;&#41;;
    current_mc.reflection_mc.createEmptyMovieClip&#40;"imgHolder_mc", current_mc.main_mc.getNextHighestDepth&#40;&#41;&#41;;
    current_mc.main_mc.createEmptyMovieClip&#40;"mask_mc", current_mc.main_mc.getNextHighestDepth&#40;&#41;&#41;;
    current_mc.reflection_mc.createEmptyMovieClip&#40;"mask_mc", current_mc.main_mc.getNextHighestDepth&#40;&#41;&#41;;
    var w = home_mc.thumb_mc.main_mc._width - 4;
    var h = home_mc.thumb_mc.main_mc._height - 4;
    with &#40;current_mc.main_mc.mask_mc&#41;
    &#123;
        beginFill&#40;255, 30&#41;;
        lineStyle&#40;0, 16711935, 50&#41;;
        moveTo&#40;&#40;0 - w&#41; / 2, 0 - h - 2&#41;;
        lineTo&#40;w / 2, 0 - h - 2&#41;;
        lineTo&#40;w / 2, -2&#41;;
        lineTo&#40;&#40;0 - w&#41; / 2, -2&#41;;
        lineTo&#40;&#40;0 - w&#41; / 2, 0 - h - 4&#41;;
        endFill&#40;&#41;;
    &#125;

    with &#40;current_mc.reflection_mc.mask_mc&#41;
    &#123;
        beginFill&#40;255, 30&#41;;
        lineStyle&#40;0, 16711935, 50&#41;;
        moveTo&#40;&#40;0 - w&#41; / 2, 0 - h - 2&#41;;
        lineTo&#40;w / 2, 0 - h - 2&#41;;
        lineTo&#40;w / 2, -2&#41;;
        lineTo&#40;&#40;0 - w&#41; / 2, -2&#41;;
        lineTo&#40;&#40;0 - w&#41; / 2, 0 - h - 4&#41;;
        endFill&#40;&#41;;
    &#125;

    current_mc.main_mc.setMask&#40;current_mc.main_mc.mask_mc&#41;;
    current_mc.reflection_mc.setMask&#40;current_mc.reflection_mc.mask_mc&#41;;
    image_mcl.loadClip&#40;filename, current_mc.main_mc.imgHolder_mc&#41;;
    image_mcl.loadClip&#40;filename, current_mc.reflection_mc.imgHolder_mc&#41;;
&#125;

init&#40;&#41;;
stop&#40;&#41;;

Exo dhmiourghsei ena dynamiko xml (file/video/latestscrollers.php) apo opou kalei ta thumbnails kai kapoia stoixeia apo thn vash... exo dosei ORDER BY id DESC, dhl. na mou vgazei prota tis teleutaies kataxorhseis kati pou den symbainei afou mou ta dinei random! Se poio shmeio tou kodika kalei random tis kataxorhseis giati ego eimai ligo asxetos me thn flash?

demo edo

Άβαταρ μέλους
Knorcedger
Script Master
Δημοσιεύσεις: 1226
Εγγραφή: 18 Μάιος 2004 04:29
Επικοινωνία:

Provlhma me actionscript

Δημοσίευση από Knorcedger » 23 Σεπ 2007 02:08

Μάλλον στο σημείο που υπάρχει η λέξη random. Είναι πολύ μεγάλος ο κώδικας για να κάτσω να τον διαβάσω όλο.
Εικόνα
myUbuntu.gr[Ελληνικός οδηγός για Ubuntu]

Άβαταρ μέλους
fafos
Script Master
Δημοσιεύσεις: 6231
Εγγραφή: 30 Νοέμ 2004 03:09

Provlhma me actionscript

Δημοσίευση από fafos » 23 Σεπ 2007 02:57

Knorcedger έγραψε:Μάλλον στο σημείο που υπάρχει η λέξη random. Είναι πολύ μεγάλος ο κώδικας για να κάτσω να τον διαβάσω όλο.
thanks agori mou... vrhka to random se authn ths function:

Κώδικας: Επιλογή όλων

function loadXML&#40;filename&#41;
&#123;
    var data_xml = new XML&#40;&#41;;
    data_xml.ignoreWhite = true;
    data_xml.onLoad = function &#40;success&#41;
    &#123;
        if &#40;success&#41; 
        &#123;
            var __reg8 = data_xml.firstChild.firstChild.childNodes.length;
            var __reg5 = new Array&#40;&#41;;
            var __reg4 = new Array&#40;&#41;;
            var __reg7 = 0;
            while &#40;__reg7 < __reg8&#41; 
            &#123;
                __reg5.push&#40;__reg7&#41;;
                ++__reg7;
            &#125;

            __reg7 = 0;
            while &#40;__reg7 < __reg8&#41; 
            &#123;
                var __reg6 = Math.floor&#40;Math.random&#40;&#41; * __reg5.length&#41;; 
                __reg4.push&#40;__reg5&#91;__reg6&#93;&#41;;
                __reg5.splice&#40;__reg6, 1&#41;;
                ++__reg7;
            &#125;

            var __reg3 = 0;
            var __reg2 = data_xml.firstChild.firstChild.firstChild;
            while &#40;__reg2 != null&#41; 
            &#123;
                info&#91;__reg4&#91;__reg3&#93;&#93; = new Array&#40;&#41;;
                var __reg1 = __reg2.firstChild;
                while &#40;__reg1 != null&#41; 
                &#123;
                    info&#91;__reg4&#91;__reg3&#93;&#93;&#91;__reg1.nodeName&#93; = __reg1.firstChild.nodeValue;
                    __reg1 = __reg1.nextSibling;
                &#125;

                ++__reg3;
                __reg2 = __reg2.nextSibling;
            &#125;

            if &#40;__reg3 == 0&#41; 
            &#123;
                onXMLError&#40;&#41;;
            &#125;
            else 
            &#123;
                onXMLLoaded&#40;&#41;;
            &#125;


            return;
        &#125;

        onXMLError&#40;data_xml.status&#41;;
    &#125;
    ;
    data_xml.load&#40;filename&#41;;
&#125;

me ti prepei na antikatasthso to var __reg6 = Math.floor(Math.random() * __reg5.length); gia na pernei oti tou leei to order?

thanks..

Άβαταρ μέλους
Knorcedger
Script Master
Δημοσιεύσεις: 1226
Εγγραφή: 18 Μάιος 2004 04:29
Επικοινωνία:

Provlhma me actionscript

Δημοσίευση από Knorcedger » 23 Σεπ 2007 05:06

Math.floor(Math.random() * __reg5.length)

Το παραπάνω, του λέει να επιλέξει έναν τυχαίο αριθμό από το μηδέν μέχρι το __reg5.length. Άρα, θα το αντικαταστήσεις ολόκληρο με την μεταβλητή που θέλεις
Εικόνα
myUbuntu.gr[Ελληνικός οδηγός για Ubuntu]

Άβαταρ μέλους
fafos
Script Master
Δημοσιεύσεις: 6231
Εγγραφή: 30 Νοέμ 2004 03:09

Provlhma me actionscript

Δημοσίευση από fafos » 23 Σεπ 2007 18:25

Knorcedger έγραψε:Math.floor(Math.random() * __reg5.length)

Το παραπάνω, του λέει να επιλέξει έναν τυχαίο αριθμό από το μηδέν μέχρι το __reg5.length. Άρα, θα το αντικαταστήσεις ολόκληρο με την μεταβλητή που θέλεις
Dhladh to provlhma htan ena mhdeniko?? :o koita pou tha mathoume kai flash sta geramata :D

euxaristo poly... solved

Άβαταρ μέλους
Knorcedger
Script Master
Δημοσιεύσεις: 1226
Εγγραφή: 18 Μάιος 2004 04:29
Επικοινωνία:

Provlhma me actionscript

Δημοσίευση από Knorcedger » 23 Σεπ 2007 18:53

Άμα ήδη γνωρίζεις κάποια άλλη γλώσσα προγραμματισμού (και ειδικά java) η actionscript δεν θα σου φανεί και πολύ δύσκολη :)
Εικόνα
myUbuntu.gr[Ελληνικός οδηγός για Ubuntu]

Απάντηση

Επιστροφή στο “Flash γενικά”

Μέλη σε σύνδεση

Μέλη σε αυτήν τη Δ. Συζήτηση: Δεν υπάρχουν εγγεγραμμένα μέλη και 1 επισκέπτης