Welcome, Guest
  • Author Topic: issue with pop up and java PLEASE URGENT!  (Read 2367 times)

    fuhgawz

    • Server what's that
    • *
    • Posts: 9
      • View Profile
      • Email
    issue with pop up and java PLEASE URGENT!
    « on: 01/05/11, 13:29 »
    Hi, i saw your tutorial on pop up with java and it worked perfectly. but i'm having an issue with my code when i try to use variables with it. i have a thumbnailslider and when i click a thumb i want it to open a certain file inm a pop up window: this is what i have up to now:


    MovieClip.prototype.makeBorder = function (col, bsize)
    {
        var w = this._width;
        var h = this._height;
        this.createEmptyMovieClip("border_mc", 10);
        with (this.border_mc)
        {
            lineStyle(col, 16777215, 0);
            lineTo(w, 0);
            lineTo(w, h);
            lineTo(0, h);
            lineTo(0, 0);
        } // End of with
    };
    var img_array = ["prensa_14", "sep_ultim_2", "prensa_13", "sep_ultim", "prensa_12", "sep_ultim_2", "prensa_11", "sep_ultim", "prensa_10", "sep_ultim_2", "prensa_09", "sep_ultim", "prensa_08", "sep_ultim_2", "prensa_07", "sep_ultim", "prensa_06", "sep_ultim_2", "prensa_05", "sep_ultim", "prensa_04", "sep_ultim_2", "prensa_03", "sep_ultim", "prensa_02", "sep_ultim", "prensa_01", "sep_ultim_2"];
    tnailer.onThumbLoad = function (mc)
    {
        var _loc1 = mc;
        _loc1.makeBorder();
        _loc1.border_color = new Color(_loc1.border_mc);
        display = "Ultimas Campaņas " + (_loc1.no + 1) + "/" + img_array.length;
    };
    tnailer.onThumbsLoaded = function (null)
    {
        display = "";
    };
    tnailer.onThumbOver = function (mc)
    {
        mc.border_color.setRGB(null);
    };
    tnailer.onThumbOut = tnailer.onThumbReleaseOutside = function (mc)
    {
        if (mc != this.active)
        {
            mc.border_color.setRGB(null);
        } // end if
    };
    tnailer.onThumbRelease = function (mc)
    {
       var _loc2 = mc;
        this.active.border_color.setRGB(null);
        this.active = _loc2;
       _loc2.border_color.setRGB(null);
        mc.border_color.setRGB(null);
       getURL ("javascript:NewWindow=window.open('../images/noticias/flash/zoom/prensa_ + _loc2.no + .swf','newWin','width=775,height=531,left=95,top=147,toolbar=No,location=No,scrollbars=No,status=No,resize=No,fullscreen=No'); NewWindow.focus(); void(0);");
    };
    tnailer.loadThumbnails(img_array, "../images/noticias/flash/thumbs/");
    display = "Cargando Ultimas Campaņas 1/" + img_array.length;


    in red is the part with the issue. i call the var "loc2" to identify the file to open. but nothing happens...
    i guess i have a stupid mistake with quotation marks or something, but i can't figure it out and im desperate.
    thanks in advance!!!

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: issue with pop up and java PLEASE URGENT!
    « Reply #1 on: 01/05/11, 16:53 »
    try this:

    '../images/noticias/flash/zoom/prensa_ ' +  _loc2.no + '.swf'
    happy flashing
    8)
    Ronald

    fuhgawz

    • Server what's that
    • *
    • Posts: 9
      • View Profile
      • Email
    Re: issue with pop up and java PLEASE URGENT!
    « Reply #2 on: 01/05/11, 18:36 »
    yeah i tried that, sorry.
    i didn't work either.

    i forgot to mention that this .swf is contained in a .php. don't know if it has somethjing to do with it....


    fuhgawz

    • Server what's that
    • *
    • Posts: 9
      • View Profile
      • Email
    Re: issue with pop up and java PLEASE URGENT!
    « Reply #3 on: 01/05/11, 18:46 »
    maybe you can see it beter with the site:

    http://www.kalpakian.com/noticias/ultimas_campanas.php

    each picture should open a pop up according to the matching picture.
     right now a pop-up appears, but it is always the same one. in the meantine i put '../images/noticias/flash/zoom/prensa_12.swf'

    those pictures in thje slider are "prensa_14", "prensa_13", etc

    thanks for your help Ronald!
    « Last Edit: 01/05/11, 19:02 by fuhgawz »

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: issue with pop up and java PLEASE URGENT!
    « Reply #4 on: 01/06/11, 03:56 »
    I see, that only presa12 is showing.
    But this is hardcoded - right?

    Did you check with charles, what is requested?

    Did you try to show the variable, before it is posted?
    happy flashing
    8)
    Ronald

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: issue with pop up and java PLEASE URGENT!
    « Reply #5 on: 01/06/11, 04:02 »
    I do not see, where you set the variable _loc2.no.
    _loc2.no ist the filename - right?
    happy flashing
    8)
    Ronald

    fuhgawz

    • Server what's that
    • *
    • Posts: 9
      • View Profile
      • Email
    Re: issue with pop up and java PLEASE URGENT!
    « Reply #6 on: 01/06/11, 07:49 »
    i think that's where i messed up.
    the thing is i didn't create this code, i was just asked to update this site in order to show the pictures in a pop-up.

    the name of the file is not _loc2.no

    what i was trying to do in this part:

    tnailer.onThumbRelease = function (mc)
    {


    is to make the movie recognize which picture of the image array specified here:

    var img_array = ["prensa_14", "sep_ultim_2", "prensa_13", "sep_ultim", "prensa_12", "sep_ultim_2", "prensa_11", "sep_ultim", "prensa_10", "sep_ultim_2", "prensa_09", "sep_ultim", "prensa_08", "sep_ultim_2", "prensa_07", "sep_ultim", "prensa_06", "sep_ultim_2", "prensa_05", "sep_ultim", "prensa_04", "sep_ultim_2", "prensa_03", "sep_ultim", "prensa_02", "sep_ultim", "prensa_01", "sep_ultim_2"];

    i'm clicking, and to open the pop-up for that specific picture.

    maybe i'm trying to bite more than i can chew, but i want to learn from my mistakes.
    do you see an easier way to do this? thanks a lot for your help.

    PD: when it opened prensa_12 it was beacuse instead of telling flash to open a different pop-up for each picture i just asked it to open prensa_12 no matter what picture you clicked on it. like this:

    tnailer.onThumbRelease = function (mc)
    {
       var _loc2 = mc;
        this.active.border_color.setRGB(null);
        this.active = _loc2;
       _loc2.border_color.setRGB(null);
        mc.border_color.setRGB(null);
       getURL ("javascript:NewWindow=window.open('../images/noticias/flash/zoom/prensa_12','newWin','width=775,height=531,left=95,top=147,toolbar=No,location=No,scrollbars=No,status=No,resize=No,fullscreen=No'); NewWindow.focus(); void(0);");

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: issue with pop up and java PLEASE URGENT!
    « Reply #7 on: 01/06/11, 13:51 »
    what is stored in the mc variable structure?
    You need to pass the target somehow.
    happy flashing
    8)
    Ronald

    fuhgawz

    • Server what's that
    • *
    • Posts: 9
      • View Profile
      • Email
    Re: issue with pop up and java PLEASE URGENT!
    « Reply #8 on: 01/09/11, 18:05 »
    yeah that's the main issue here, if not the only one i guess. most of the code was done before i got to do this, the only thing i added was the pop-up part.

    i just need to set a variable that stores the information on which picture is being clicked, and ask the pop-up to open a file according to the result on that variable, am i right?

    but i'm having trouble setting that variable, any idea how i can do it?
    i tried a few more things, like setting a new var like this:

    tnailer.onThumbRelease = function (mc)
    {
        this.active.border_color.setRGB(null);
        this.active = mc;
        mc.border_color.setRGB(null);
        var _fotos = this.active;
       getURL ("javascript:NewWindow=window.open('../images/noticias/flash/zoom/' + _fotos + '.swf','newWin','width=775,height=531,left=95,top=147,toolbar=No,location=No,scrollbars=No,status=No,resize=No,fullscreen=No'); NewWindow.focus(); void(0);");
       
    };


    hoping that this.active held the information of the image being clicked, but nothing happened...


    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: issue with pop up and java PLEASE URGENT!
    « Reply #9 on: 01/10/11, 03:41 »
    again my question - what is MC?

    If you are insode of the onClick event, you receive the clicked objetc, via the this. pointer statement.

    this.name gives you the name of the object clicked.
    happy flashing
    8)
    Ronald

    fuhgawz

    • Server what's that
    • *
    • Posts: 9
      • View Profile
      • Email
    Re: issue with pop up and java PLEASE URGENT!
    « Reply #10 on: 01/10/11, 05:47 »
    i've been looking throughout the whole file to see what MC is, but it's not stated anywhere, or i can't find it.

    but, if i created a var, equal to this.name and then used that var it should work right?
    i just need to name the .swf in the pop-up the same as the thumb pressed.

    like this:

    tnailer.onThumbRelease = function (mc)
    {
        this.active.border_color.setRGB(null);
        this.active = mc;
        mc.border_color.setRGB(null);
        var _fotos = this.name;
       getURL ("javascript:NewWindow=window.open('../images/noticias/flash/zoom/' + _fotos + '.swf','newWin','width=775,height=531,left=95,top=147,toolbar=No,location=No,scrollbars=No,status=No,resize=No,fullscreen=No'); NewWindow.focus(); void(0);");
       
    };

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: issue with pop up and java PLEASE URGENT!
    « Reply #11 on: 01/10/11, 07:30 »
    which version of flash are you using?

    what happens, if you insert these statements into the function:

    trace(mc);
    trace(this);
    happy flashing
    8)
    Ronald

    fuhgawz

    • Server what's that
    • *
    • Posts: 9
      • View Profile
      • Email
    Re: issue with pop up and java PLEASE URGENT!
    « Reply #12 on: 01/10/11, 09:25 »
    i''m using CS4
    and regarding the tracing i've come to interesting things:

    trace(mc); i got    _level0.tnailer.thumbs.th0  (depending on which picture i click, the number in the red part changes)
    trace(this); i got  _level0.tnailer

    now, if i trace (mc.no) i see something usefull. the result is just a number, depending on which picture i click. 0, 1, 2, 3, etc increasing 1 number per picture in the correct order.

    SO, what i did is make a variable named foto and do this:

    var foto = mc.no;       what i get if i trace it is that same number

    and then:

    getURL ("javascript:NewWindow=window.open('../images/noticias/flash/zoom/prensa_' + foto + '.swf','newWin','width=775,height=531,left=95,top=147,toolbar=No,location=No,scrollbars=No,status=No,resize=No,fullscreen=No'); NewWindow.focus(); void(0);");


    with that it should open a file named "prensa_" and after that the number of the picture clicked and ".swf"
    i think it should work fine, but when i upload it, it does nothing.
    when i try it locally, i click and a pop-up opens, but always showing "google.com"

    i think the issue is with the quotations within the java script, which is not reading the variable as such, but as a part of the name of the file to open. the "+ foto +" appears in green just like the rest of the java code, and that makes me suspicious.
    or there is a problem when i contain the .swf in the php, which doesn't allow the pop-up to open.

    thanks again for all your help

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: issue with pop up and java PLEASE URGENT!
    « Reply #13 on: 01/10/11, 10:08 »
    try this one:

    getURL ("javascript:NewWindow=window.open('../images/noticias/flash/zoom/prensa_" + foto + ".swf','newWin','width=775,height=531,left=95,top=147,toolbar=No,location=No,scrollbars=No,status=No,resize=No,fullscreen=No'); NewWindow.focus(); void(0);");

    happy flashing
    8)
    Ronald

    fuhgawz

    • Server what's that
    • *
    • Posts: 9
      • View Profile
      • Email
    Re: issue with pop up and java PLEASE URGENT!
    « Reply #14 on: 01/10/11, 11:34 »
    thanks, i tried it before with the same results...
    thinking about it i discard the issue with communication with the .php because if i hardcode only one file, and don't use variables, the information goes through...