A Flash Developer Resource Site

Page 3 of 4 FirstFirst 1234 LastLast
Results 41 to 60 of 61

Thread: ADVENT CALENDAR - Doors not to be opened before date...

  1. #41
    Senior Member
    Join Date
    Oct 2002
    Location
    Copenhagen
    Posts
    228
    Replace:
    Code:
    getURL("http://www.promo842.com/Advent/day" + url_id + ".htm", "_self")
    with:
    Code:
    getURL ("javascript:NewWindow=window.open('http://www.promo842.com/Advent/day" + url_id + ".htm','newWin','width=450,height=300,left=0,top=0,toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No');  NewWindow.focus();void(0);");

  2. #42
    Senior Member
    Join Date
    Oct 2006
    Posts
    114
    Thanks again soooo much for all the help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  3. #43
    Senior Member
    Join Date
    Oct 2006
    Posts
    114
    Thanks again for all your help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  4. #44
    Senior Member
    Join Date
    Oct 2002
    Location
    Copenhagen
    Posts
    228
    You're welcome. Hope it works out ..

  5. #45
    Senior Member
    Join Date
    Oct 2006
    Posts
    114
    Hi again,
    just wondering one last, last thing.... Can I get the numbers of previous days to vanish. I tried putting this bit of code in but it doesn't work.

    PHP Code:
    var disable_pre_date_txt        :Boolean        true
    Do u know what to put to make this work?

  6. #46
    Senior Member
    Join Date
    Oct 2006
    Posts
    114
    Hi,
    Forget the previous problem I fixed it. I still have another one though...
    The problem is that I need the previous doors to still be click able and bring up a link like they would do if it was that day.

    Calendar here...
    http://www.promo842.com/Advent/
    Code below...

    If anyone could help it would save my life.
    Thanks!
    Stefan Costain

    PHP Code:
    var open_pre_doors        :Boolean        true// toggle true/false, if previous doors should be open/closed
    var show_pre_dates        :Boolean        true;    // toggle true/false, if previous dates should be visible/not visible    
    var disable_doors        :Boolean        true;    // toggle true/false, if previous doors should be enabled/disabled


    // retrieve date from client-computer
    var todaysDate:Date = new Date();
    //var active_date = (Number(todaysDate.getDate()));
    var active_date = (Number(todaysDate.getDate()));


    function 
    init(){
        
    date_door_mc._visible false;
        
        
    // loops script 24 times
        
    for (var i:Number 024i++){
            
            
    // copy and plays all doors on stage
            
    date_door_mc.duplicateMovieClip("door_" i_root.getNextHighestDepth());
            
            if (
    5){
                
    _root["door_" i]._x = (_root.date_door_mc._width 5) * 340;
                
    _root["door_" i]._y 160
            
    }else if (10){
                
    _root["door_" i]._x = (_root.date_door_mc._width 5) * (i-5) + 340;
                
    _root["door_" i]._y 220
            
    }else if (15){
                
    _root["door_" i]._x = (_root.date_door_mc._width 5) * (i-10) + 340;
                
    _root["door_" i]._y 280
            
    }else if (20){
                
    _root["door_" i]._x = (_root.date_door_mc._width 5) * (i-15) + 340;
                
    _root["door_" i]._y 340
            
    }else if (25){
                
    _root["door_" i]._x = (_root.date_door_mc._width 5) * (i-20) + 340;
                
    _root["door_" i]._y 400
            
    }
            
            
    // fills the textfields with dates
            
    _root["door_" i].date_txt.text i+1;
            
            
    // sets all previous doors to opened
            
    if (open_pre_doors == true){
                if (
    active_date-1){
                    
    _root["door_" i].door_mc._visible false;
                }
            }
            
            if (
    show_pre_dates == false){
                if (
    active_date-1){
                    
    _root["door_" i].date_txt.text "";
                }
            }
            
            
    // defines button actions
            
    _root["door_" i].onRelease = function(){
                
                
    // plays door animationa and gets rid of numbers on doors when pressed and sets url-date-id
                
    _root["door_" + (this._name.substr(5,2))].door_mc.play();
                
    _root["door_" + (this._name.substr(5,2))].date_txt.text "";
                
    date_id this._name.substr(5,2)
                
    url_id Number(date_id) + 1;
                
                if (
    url_id 10){
                    
    url_id "0" url_id;
                }else{
                    
    url_id url_id;
                }
                
                
    // empties textfield, disables door-click, opens door, sets http-url
                
    this.date_txt.text "";
                
    _root["door_" date_id].door_mc._visible true;
                
    this.enabled false;
                
                
    onload=window.resizeTo(width,height)
                
    getURL ("javascript:NewWindow=window.open('http://www.promo842.com/Advent/day" url_id ".htm','newWin','width=450,height=300,left=0,top=0,toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No');  NewWindow.focus();void(0);");
                
            }
            
            
    // disables doors
            
    if (disable_doors == true){
                
    _root["door_" i].enabled false;
            }else{
                if (
    active_date+1){
                    
    _root["door_" i].enabled false;
                }
            }
        }
        
        
    // enables only todays door for clicking
        
    _root["door_" + (active_date-1)].enabled true;
        
    }


    init(); 

  7. #47
    Senior Member
    Join Date
    Oct 2006
    Posts
    114

    all fixed...

    sorry ignor the last problem also.... all is fixed. Thanks again for the help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  8. #48
    Junior Member
    Join Date
    Oct 2008
    Posts
    1

    Is it possible to get the fla ?

    Hi,
    I am looking for the same ;-)
    Is it possible to get the fla-file ? in version 8
    Thanks, best regards
    Thomas J. Denmark

  9. #49
    Junior Member
    Join Date
    Nov 2008
    Posts
    7
    Quote Originally Posted by lash
    take a look at the attached file. This should do the trick.

    Perhaps you should have started the project a little earlier :-)
    Where is the attached file that you sent back?

  10. #50
    Junior Member
    Join Date
    Nov 2009
    Posts
    6
    Hi there i am doing almost the same thing as stefancostain. I am not an experienced flash user and having a bit of problem ounderstanding where to putt everything. I want to use this funtion:

    import fl.transitions.easing.*;
    import fl.transitions.Tween;
    import fl.transitions.TweenEvent;

    var at:Array = new Array();


    at.push(new Tween(door1,'rotationY',Strong.easeIn,0,90,2,true) );

    at[0].addEventListener(TweenEvent.MOTION_FINISH,goin);

    function goin(e:Event){
    at.push(new Tween(door1,'z',Strong.easeIn,0,0,2,true));

    to open the hatches. Where will that code go? I was hoping that i could just take the code printed here and modify it to get it in place but no success yet.
    I know this is an old thread but it would be great if someone could help me out.

  11. #51
    Senior Member
    Join Date
    Oct 2002
    Location
    Copenhagen
    Posts
    228
    This said it depends on when you want the function triggered? On door click? Place it within this function, but keep in mind that this is a loop, where the doors are generated dynamically wich means that you'll have to apply the Tween dynacically to each door as well

    Code:
    _root["door_" + i].onRelease = function(){
    // put all door click code here
    }

  12. #52
    Junior Member
    Join Date
    Nov 2009
    Posts
    6
    Thanks for a quick answer

    To make it simple, this is what i want to do:

    1. On the right date the specific door is going to be klickable followed by the process of the door that opens.

    2 Behind the door a picture that sas "take me to the winner of the day" when i click on this picture its gonna take me to an external http:// adress.

    And this is what i have done:

    1 background.

    24 haches(doors) named door1, door2, door3 ext alla are movieclips. Placed in seperate layers.

    1 layer for AS3.

    Right now i have deleted all the code exept this:

    Stage["door_" + i].onRelease = function(){
    // put all door click code here

    import fl.transitions.easing.*;
    import fl.transitions.Tween;
    import fl.transitions.TweenEvent;

    var at:Array = new Array();


    at.push(new Tween(door1,'rotationY',Strong.easeIn,0,90,2,true) );

    at[0].addEventListener(TweenEvent.MOTION_FINISH,goin);

    function goin(e:Event){
    at.push(new Tween(door1,'z',Strong.easeIn,0,0,2,true)); }

    That i supose i have to place in every door and chance the door name depending on the date. Flash tells me that _root is no longer in use and sugest Stage instead.

    So plese help me where do i go from now? I really have no knowledge in Actionscript.

  13. #53
    Senior Member
    Join Date
    Oct 2002
    Location
    Copenhagen
    Posts
    228
    This is because the code in the thread is written using AS2 and you are trying to adding AS3 code to this and exporting the code as such. If you want to use the this code, you'll have to use AS2 and export as AS2.

  14. #54
    Junior Member
    Join Date
    Nov 2009
    Posts
    6
    that explains a lot of it. I think my code for the door is designed for AS3 so it probably wont work? i made a new document based on AS2 and pasted my content from the old file to the new (dont know if this is the right way).

    Where do i go from here, i am trying to get the door to work first, then import the code from the erlier atempts in this post. Or is it a way to get my code to work in AS2, it would save me a lot of trouble?

  15. #55
    Senior Member
    Join Date
    Oct 2002
    Location
    Copenhagen
    Posts
    228
    This code should work by default, but you'll of course have to adopt it to your own file and movieclips.

    date_door_mc reefers to a moviclip with a dooranimation within and a stop action in first frame. You will have to create such a movieclip and name it date_door_mc and place it on your stage. Unfortunately I haven't got the FLA anymore, so I will not be not able to send it to you. It's not much work but of course if you are not use to actionscript you'll have to do some trial and error on this one.

    Code:
    var open_pre_doors        :Boolean        = true; // toggle true/false, if previous doors should be open/closed 
    var show_pre_dates        :Boolean        = true;    // toggle true/false, if previous dates should be visible/not visible     
    var disable_doors        :Boolean        = true;    // toggle true/false, if previous doors should be enabled/disabled 
    
    
    // retrieve date from client-computer 
    var todaysDate:Date = new Date(); 
    //var active_date = (Number(todaysDate.getDate())); 
    var active_date = (Number(todaysDate.getDate())); 
    
    
    function init(){ 
        date_door_mc._visible = false; 
         
        // loops script 24 times 
        for (var i:Number = 0; i < 24; i++){ 
             
            // copy and plays all doors on stage 
            date_door_mc.duplicateMovieClip("door_" + i, _root.getNextHighestDepth()); 
             
            if (i < 5){ 
                _root["door_" + i]._x = (_root.date_door_mc._width + 5) * i + 340; 
                _root["door_" + i]._y = 160 
            }else if (i < 10){ 
                _root["door_" + i]._x = (_root.date_door_mc._width + 5) * (i-5) + 340; 
                _root["door_" + i]._y = 220 
            }else if (i < 15){ 
                _root["door_" + i]._x = (_root.date_door_mc._width + 5) * (i-10) + 340; 
                _root["door_" + i]._y = 280 
            }else if (i < 20){ 
                _root["door_" + i]._x = (_root.date_door_mc._width + 5) * (i-15) + 340; 
                _root["door_" + i]._y = 340 
            }else if (i < 25){ 
                _root["door_" + i]._x = (_root.date_door_mc._width + 5) * (i-20) + 340; 
                _root["door_" + i]._y = 400 
            } 
             
            // fills the textfields with dates 
            _root["door_" + i].date_txt.text = i+1; 
             
            // sets all previous doors to opened 
            if (open_pre_doors == true){ 
                if (i < active_date-1){ 
                    _root["door_" + i].door_mc._visible = false; 
                } 
            } 
             
            if (show_pre_dates == false){ 
                if (i < active_date-1){ 
                    _root["door_" + i].date_txt.text = ""; 
                } 
            } 
             
            // defines button actions 
            _root["door_" + i].onRelease = function(){ 
                 
                // plays door animationa and gets rid of numbers on doors when pressed and sets url-date-id 
                _root["door_" + (this._name.substr(5,2))].door_mc.play(); 
                _root["door_" + (this._name.substr(5,2))].date_txt.text = ""; 
                date_id = this._name.substr(5,2) 
                url_id = Number(date_id) + 1; 
                 
                if (url_id < 10){ 
                    url_id = "0" + url_id; 
                }else{ 
                    url_id = url_id; 
                } 
                 
                // empties textfield, disables door-click, opens door, sets http-url 
                this.date_txt.text = ""; 
                _root["door_" + date_id].door_mc._visible = true; 
                this.enabled = false; 
                 
                onload=window.resizeTo(width,height) 
                getURL ("javascript:NewWindow=window.open('http://www.promo842.com/Advent/day" + url_id + ".htm','newWin','width=450,height=300,left=0,top=0,toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No');  NewWindow.focus();void(0);"); 
                 
            } 
             
            // disables doors 
            if (disable_doors == true){ 
                _root["door_" + i].enabled = false; 
            }else{ 
                if (i > active_date+1){ 
                    _root["door_" + i].enabled = false; 
                } 
            } 
        } 
         
        // enables only todays door for clicking 
        _root["door_" + (active_date-1)].enabled = true; 
         
    } 
    
    
    init();

  16. #56
    Junior Member
    Join Date
    Nov 2009
    Posts
    6
    so far so good. i have put the as2 code you sent me in a layer named as2

    The doors are radomly placed all over the flash file and every door has to be unique because every one has its own picture to match the calender.

    Can i make it work someway without doing diffrent actionscripts for each door?
    Im guessing 24 diffrent actionscript codes wont work well with the code you sent me?

    Thank you so much for your help!

  17. #57
    Senior Member
    Join Date
    Oct 2002
    Location
    Copenhagen
    Posts
    228
    sure! the easy way would be creating 24 movieclips and placing your picture within those mc's. Then export these movieclips in your properties dialog (rigthclick on your mc in the library) with unique names (i.e. content_0, content_1, content_2 etc) and then attach the corresponding clip to your duplicated door movieclip using attachMovieclip() inside the for-loop.

  18. #58
    Junior Member
    Join Date
    Nov 2009
    Posts
    6
    Quote Originally Posted by lash View Post
    sure! the easy way would be creating 24 movieclips and placing your picture within those mc's. Then export these movieclips in your properties dialog (rigthclick on your mc in the library) with unique names (i.e. content_0, content_1, content_2 etc) and then attach the corresponding clip to your duplicated door movieclip using attachMovieclip() inside the for-loop.
    I am really starting to get lost i know what you mean but have no clue how to exicute it. If its not to much to ask of you, could i email the whole thing to you so you can se what i have done and what needs to be done.??? If you have the time you would do me a great favor. Btw are you danish speaking? I really dont want to post it here on the forum.

  19. #59
    Senior Member
    Join Date
    Oct 2002
    Location
    Copenhagen
    Posts
    228
    I can help you, but not within the next few days.

    PS. I do speak danish

  20. #60
    Junior Member
    Join Date
    Nov 2009
    Posts
    6
    Quote Originally Posted by lash View Post
    I can help you, but not within the next few days.

    PS. I do speak danish
    Hi Lash since i dont have the time or knowledge for this i have decided not to do the calender by the date. therfore all haches will be be open all the time.

    But since you seem to have a lot of knowledge in the area i have a question about as3(i decided to use as3 instead) . here it goes,

    Behind the haches i have 24 pictures that all are the same and will lead to the same url page. So i done the button link working for as3. BUT when i copy this picture all over the 24 haches they stop working. Why?

    Im really greatfull for your help!

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