8 Replies Latest reply on Dec 11, 2009 7:45 AM by SalteMishel

    filled colour as a variable? and setting layer to not block the content underneath?

    SalteMishel

      I wonder if it's possible to take the filled colour (filled with  myColor.setRGB(0x993366); like a colouring style) and set the colour filled to be a value of a variable in an if statement? if yes, anyone know how to do it?

       

      and is it possible to set a layer's content so that it does not block any button underneath it? I'm trying use that movie as a mask but I do not want it to block any activity underneath it. or is it better to use the myMovieClip .setMask ( maskMovieClip )(I don't really know how to use this) I only need the masking to appear when a specific button is pressed. Hope my english isn't too confusing. Thanks.

        • 1. Re: filled colour as a variable? and setting layer to not block the content underneath?
          Saransoft84

          Hi,

           

          Could U explain about your need.

           

          U want to store the color value to the variable

          or

          change the color to a particular text.

           

          Saransoft

          • 2. Re: filled colour as a variable? and setting layer to not block the content underneath?
            SalteMishel Level 1

            I want to want to store the color value to the variable

             

            I'm trying to do something like this but the one that will work. XD

             

            on(release){if(_root.colouring.c1.cc1.fillColor == (0xFF0000) &&

             

            _root.colouring.c2.cc2.fillColor == (0xFFFF00)&&

             

            _root.colouring.c3.cc3.fillColor == (0xFF6600))

            {

             

            _root.colouring.check1.gotoAndStop(2)

             

             

            }

             

            }

             

            and for the layer thingie, I found some similar solution but it's for actianscript 3.0 though, I'm using actionscript2.0 >< do you know the solution for AC2?

            http://blog.pixelfumes.com/?p=197&cpage=1#comment-12036

             

            Thanks for replying. ^^

            • 3. Re: filled colour as a variable? and setting layer to not block the content underneath?
              Rothrock Level 5

              Yes. If you check the documentation for the Color class you will see there is a getRGB() method which returns the value set by the setRGB() method. However it doesn't tell you what color something is, it tells you what color transform has been assigned to that object. So if you make a movie of a red square and you do this:

               

              var myColor:Color=new Color(myClip);
              trace(myColor.getRGB()); // traces "0"

               

              Which could either mean it has been tranformed to black or that it has no transform (which is the case here.)

               

              What you are seems more complicated than it probably needs to be. What are you actually trying to do? How are these clips having their transforms assigned? What does it mean that they are a certain color.

               

              As for the layer thing. I have no idea what you are talking about.

               

              BTW, here is something you didn't ask for. Using the on(event) type handler coding went out of style with the introduction of Flash 6 in 2002. It is a very inefficient way to code and is very difficult to maintian because you have to look through all your items to find the code. Most folks these days put the code on the timeline where it is all in one place and easier to maintain. Here is a great article about it:

               

              http://www.quip.net/blog/2006/flash/museum-pieces-on-and-onclipevent

              • 4. Re: filled colour as a variable? and setting layer to not block the content underneath?
                SalteMishel Level 1

                What I'm trying to do is like, hmm if they colour the first square with red and second with yellow and the third square is orange if the values are correct, then I will display a tick.

                [IMG]http://i706.photobucket.com/albums/ww61/WitchXHunter/colour.png[/IMG]

                 

                Is it possible to assign "red" to a variable then the box is coloured with red? so that I can use if (variable=="") statement.

                 

                Thanks for the article. I see, I'll get it to use during my next assignments then, I'm almost done with all part of the assignment just have to solve this colour exercise.  Guess my college materiak is out of date as the teacher teaches the old method, acutally she just throw some bunch of tutorials to us anyway. lol.

                 

                Thanks for the help. Hope you're still here, need help very urgently. rushing to finish this by today. XP

                • 5. Re: filled colour as a variable? and setting layer to not block the content underneath?
                  Rothrock Level 5

                  Interesting. Yes you can assign a variable to each box as it is colored. Movieclips are dynamic, so you can just give them any only property as you go.

                   

                  myBox1.assignedColor="red"

                   

                  or

                   

                  myBox2.assignedColor=0xff0000

                   

                  Your conditionals are going to be pretty complex because you will need to check both:

                   

                  red + yellow = orange

                  yellow + red = orange

                   

                  and so on. So there are six checks for each one. I think a binary representation might be helpful. I'll post back in a little bit.

                  • 6. Re: filled colour as a variable? and setting layer to not block the content underneath?
                    Rothrock Level 5

                    Well my idea isn't working out. So I hope you have something in mind. The variables will work as described. I'm just wondering how you are doing the conditional checking!

                    • 7. Re: filled colour as a variable? and setting layer to not block the content underneath?
                      Rothrock Level 5

                      Okay so maybe it will work. If you have the following values:

                       

                      red=1        // binary 001

                      yellow=2   // binary 010

                      blue=4      // binary 100

                      orange=3  // binary 011

                      purple=5   // binary 101

                      green=6    // binary 110

                       

                      And assuming that somehow the value with your first box is val1, the second box is val2, and the third box (the mixed color) is val3.

                       

                      if((val1|val2)==val3 && (val1^val2)==val3){

                      trace("Correct")

                      } else {

                      trace("Not correct");

                      }

                       

                      I think that works. It takes care of cases where the student might put red + red = red (which is true, but presumably you don't want as a choice). It also takes care of red + yellow = orange and yellow + red = orange. And finally I think it works for things like orange+green =???.

                       

                      If you look at the values in binary you can see that each of the primary colors have a 1 in a colum for them and that each of the secondary colors have 1s in the column of the two primary colors that are used to make them.

                       

                      These are separate from the hex values used to make the actual colors show on screen. Especially since the hex values of color are red, GREEN, and blue -- the primary colors of light.

                       

                      Well anyways. I'm guessing that is more confusing than helpful. But it sure was fun for me to figure out!

                      • 8. Re: filled colour as a variable? and setting layer to not block the content underneath?
                        SalteMishel Level 1

                        *Giggles* at the end I still didn't figure it out at 5.06am. so I just left it like some sort of children colouring box. Pretty proud of myself coz the teacher wasn't actually teaching and it was pretty fun to figure everything out searching here and there. XD

                         

                         

                        I've passed the assignment up, but guess it won't hurt to improve it still. XD Hope I'll be able to figure it out. Guess I'll share the finish product, this is my first interactive flash project. XD

                        You'll need the password to sign in to view. Attached 3 files think they have to be kept in the same folder for the video to work.Hope you don't mind me asking this question but where/how do we normally upload our swf files? Thanks for your help. I'll tell you if I eventually success figuring out. XD

                        Name: Rothrock

                        Student ID: Thanks