A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: Whats wrong with my code!

  1. #1
    Senior Member
    Join Date
    May 2002
    Posts
    132

    Whats wrong with my code!

    I have a movieclip on the stage on a keyframe that has a stop. he movieclip has its _alpha manually set to o using the properties pane.

    What I need it to do is when the clip enters the movieclip it asks itself is my alpha less then 100% YES then ok increase myself by 5%. Because I have a stop and I am using an onClipEvent(enterframe) it should gradually increase until its aplha reaches 100%. It appears to be doing that ok as the clip fades in gradually. What I need it to do then is once it has reached 100% it should break its loop and move to frame 2 with the label "s2" but it is not doing that.

    Code on the movieclip
    --------------------------

    onClipEvent(enterFrame){
    if (this._alpha != (100){
    this._alpha +=5;
    }else{
    gotoandPlay("s2");
    }
    }

    As I said it fades up alright but wont go to the appropriate next frame once it reaches full alpha.

    It has to be something simple!


    If anyone can help then I would be most grateful.

    Thanks pixelmagik

  2. #2
    Professional Air Guitarist Frag's Avatar
    Join Date
    Dec 2002
    Location
    Brain, Body, Clothes, Computer Chair, Room, House, Neighborhood, City, State, Country, Continent, World, Galaxy, Universe, and on?
    Posts
    811
    if (this._alpha != (100){

    take out the ( before the 100

    and gotoandPlay should be gotoAndPlay

  3. #3
    Senior Member
    Join Date
    May 2002
    Posts
    132
    Thanks for your swifrt reply,

    Just changed the code as per your reply and still nothing it fades up then stops and does nothing when it is 100%

    Pixelmagik

  4. #4
    Professional Air Guitarist Frag's Avatar
    Join Date
    Dec 2002
    Location
    Brain, Body, Clothes, Computer Chair, Room, House, Neighborhood, City, State, Country, Continent, World, Galaxy, Universe, and on?
    Posts
    811
    try:

    if (this._alpha <= 100) {

    and

    this.gotoAndPlay("s2");

    *make sure your frame is properly named
    Last edited by Frag; 11-26-2003 at 01:30 AM.

  5. #5
    Senior Member
    Join Date
    May 2002
    Posts
    132
    I have attached the file so you can see better what I am trying to do and how it is setup. Feel free to change it round to how you think the code should work.

    Maybe yiou can see exactly what is wrong by looking at it.

    Appreciate your help

    Pixelmagik
    Attached Files Attached Files

  6. #6
    Professional Air Guitarist Frag's Avatar
    Join Date
    Dec 2002
    Location
    Brain, Body, Clothes, Computer Chair, Room, House, Neighborhood, City, State, Country, Continent, World, Galaxy, Universe, and on?
    Posts
    811
    FIXED!!!
    Last edited by Frag; 04-13-2008 at 02:09 PM.

  7. #7
    Senior Member
    Join Date
    May 2002
    Posts
    132
    Thanks Very Muchly,

    Just for my growth and stuff what was wrong that made it not work.

    Pixelmagik

  8. #8
    Professional Air Guitarist Frag's Avatar
    Join Date
    Dec 2002
    Location
    Brain, Body, Clothes, Computer Chair, Room, House, Neighborhood, City, State, Country, Continent, World, Galaxy, Universe, and on?
    Posts
    811
    You needed a <= in stead of a !=. With not equal to, if the _alpha went over 100, it would just keep going. Less than or equal to will cover 100+.

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