text:
The difference between root domain, subdomain and URL level explained
In Majestic Site Explorer and reports, users have the opportunity to look at sites on the root domain, subdomain or on the individual URL level. In this post we'll be looking at what these different terms mean and why you might want to be able to analyse sites on these different levels.
Reports and Site Explorer queries taken at the root domain level will return results for the whole of the website being analysed. The root domain is the overarching structure which contains the subdomains and every URL. If you want the data for an entire site, sticking with the root domain will likely be the easiest way to access this data. An example of a root domain would be example.com
Root domains are sometimes subdivided into other smaller domains called subdomains. Common reasons for this might include different subdomains covering different languages or regions. Examples from Majestic would be our French site at the subdomain https://fr.majesticseo.com/ or our German site at https://de.majesticseo.com/. If you're looking for data only on a specific subset of the root domain, you may be best served doing your analysis on the subdomain level. These subdomains are smaller parts of the root domain so you'll see fewer backlinks and referring domains on the subdomain level.
Looking at the URL level will let you see the data for any individual page within a site. If you were interested in just the data from a specific page on a domain, this would be a great way to get focused information on just that page. An example of this would be https://www.majesticseo.com/support/contact-us. These pages make up the content that populates the domain and subdomains. You'll see fewer backlinks and referring domains for individual pages than for the subdomains or domains in which they sit.
8 Responses to "The difference between root domain, subdomain and URL level explained"
If the root domain is example.com what is http://www.example.com considered? Does is have any seo benefit to have everything pointing to example.com over http://www.example.com? Thanks in advance.
> I'm pretty sure Google reads both example.com and http://www.example.com with or without hyperlink. The SEO benefit would be giving the user a direct click.
Thank you Nicola for sharing basic tutorial it's good for beginners, If you share your views by adding pictures / screenshot it will be better.
This excellent website definitely has all the information I wanted about this subject
and didn't know who to ask.
Hi There
When purchasing expired domes with age and quality back links, which of the two settings should one focus on Root or URL,
I would look at Trust Flow, at the ROOT level. I would also worry if Citation Flow was (say) 2X higher than the Trust Flow as it suggests the domain would have been part of a link farm at some point and may need some cleaning up.
Any idea why the sub-domain and root domain results differ?I mean when I'm checking the same domain name with root domain settings I'm getting different results than if it sets to sub-domain.
You are getting different results because you are using different scopes of analysis – root domain shows everything for the root domain (this includes data for all subdomains on that root domain), subdomain level will only analyse links pointing to that exact subdomain, which is typically less than all data on root domain level.


text:
Recent News
McGinley ends career on a winning note
September 29, 2014
McGinley is ready to call it a career in the Ryder Cup after winning all six events he's competed in.Read more
Europe wins Ryder Cup again
September 28, 2014
Europe won the Ryder Cup on Sunday for the third straight time.Read more
John Cook wins Champions Tour's First Tee Open
September 28, 2014
Stephen Ames finishes tied for 24th.Read more
US beats World 28-20 in ISPS Handa Cup
September 28, 2014
The U.S. now leads the series 7-1-1.Read more
CN Future Links crown National Junior Skills Challenge champions
September 27, 2014
Three boys and three girls take home honours as national champions of respective age groups.Read more
DeLaet Foundation raises over $1,200 for Golf in Schools program
September 25, 2014
Foundation donated $1 for each follower the @Fore_Kids Twitter handle received in mid-September.Read more
CN Future Links Adopts 15 Schools in Saskatoon region
September 24, 2014
CN continues to extend junior programming support through Golf in SchoolsRead more
Golf Fore the Cure celebrates success at 11th annual National Event
September 24, 2014
More than 100 ladies were on hand at Carrying Place Golf and Country Club in King, Ont. to celebrate the years fundraising efforts.Read more
On the BlogsMore Blogs
Callaway reveals Big Bertha Irons and Hybrids
September 30, 2014
New clubs will be available online and at retailers starting October 17th.Read more
Step into a ruling…
September 23, 2014
Revisiting the recent Canadian Men's Mid-Amateur Championship and a unique rules situation at Barrie Country Club.Read more
Celebrating the career amateur
September 22, 2014
Stay amateur or turn pro? John Gordon talks with Canada's greatest amateur golfers and examines why they chose to forego the professional ranks.Read more
This week's Global Golf Post
September 22, 2014
Check out what's in this weeks Global Golf Post.Read more
Team Canada's Corey Conners joins ISM
September 17, 2014
The 22-year-old becomes first Canadian to join International Sports Management roster of golfers.Read more

subset: commoncrawl


text:
[Prev] Thread [Next] | [Prev] Date [Next]
[coyotos-dev] Change to PATTs Jonathan S. Shapiro Thu Aug 31 03:58:39 2006
I'm not going to get the specification revised tonight, but we are going to make a change to the PATT structure. The 'r' field will become per-slot, and in consequence the PATT structure is now much closer to the GPT design. The reason for this change is that the "one r per patt" rule results in a situation where there is no tree construction algorithm that does a good job in all cases. Depending on the order in which tree inserts are done, you may have to rebalance the tree, and this is very much beyond anything we want to try in the kernel. Making the 'r' value be per-slot adds the cost of a per-slot shift, but this is not a significant factor in overall performance. The main factor is that PATTs incur an extra cache miss in comparison to nodes. Actually, the number of extra misses is very sensitive to the processor family, and we need to look at this pretty carefully. All in all, however, I think this is a negligable effect, and I continue to think that PATTs are a better structure than nodes for our purposes; even at the cost of the extra cache miss. shap _______________________________________________ coyotos-dev mailing list [EMAIL PROTECTED] http://www.coyotos.org/mailman/listinfo/coyotos-dev
- [coyotos-dev] Change to PATTs Jonathan S. Shapiro 2006/08/31 <=


text:
Posts Tagged 'autocorrect'
Top Lists
21 of the Funniest Auto Correct Private Part Mishaps (list)
Auto Correct is a bitch...we've all experienced some communication mishap with the system. But as annoying as it can be, it's still funny as hell to see what transpires from the miscommunication auto correct texts/messages. Her...
30 of the Funniest NSFW Autocorrect Texts (list)
Have a case of the Mondays? Fret no more and have a laugh or two with these hilarious NSFW Autocorrect posts! It seems that Autocorrect and co-workers/bosses don't seem to mix well...but they do make for some funny texts. 30. E...
Autocorrect makes for lots of laughs, especially when they turn sexual. But it's an entirely new level when autocorrect sexualizes texts from the parental units. For this version of autocorrect texts turned sexual, we've compil...


text:
Looking for Alternatives to Eggs & Breakfast Breads
Good Questions
Q: I love breakfast and brunch, but I don't really like eggs (scrambled, frittata or otherwise).
I'm starting to get sick of granola and pancakes/waffles/muffins. Any suggestions?
Sent by belmontmedina
Editor: Why not go a different way with dairy and try layered yogurt parfaits and homemad yogurt cups?
• Make Your Own Fruit-on-the-Bottom Yogurt Cups
Readers, what are some other creative, non-egg, non-bread ideas for belmontmedina's breakfast?
Related: Salad to Sushi: 5 Surprisingly Good Breakfasts
(Image: Faith Durand)
27 Comments
tofu scramble!
The important thing to remember about "breakfast foods" is if it's nutritious and it doesn't make you ill early in the morning, you can eat it. Anything you enjoy for lunch or dinner can also be enjoyed at breakfast. It's just a third meal.
That said, a lot of my favorite breakfasts are things that have already been mentioned here this week: salad, grain porridges, avocado toast, yoghurt, etc.
glass of kefir w/ fruit salad, smoothies, cottage cheese,
I agree that anything can be eaten for breakfast if you want it to be. I even like leftover Indian food in the morning (while in India I got used to roti, plain yogurt, and pickle in the morning, it was such an interesting, but simple, combination).
One of my favorite breakfasts is some shredded cabbage wilted with a little water, broth and/or soy sauce, then add in some [cooked] soba noodles, pan "fry" it (though really, I used hardly any oil) and sometimes I'll add an egg, though that can be omitted. Savory and filling.
Ooh, or baked polenta with bacon & wilted greens.
I like to take a bit of meat (bacon or sausage usually, but we've used leftover chicken/pork/whatever too, and it still comes out good), saute that up in my dutch oven (any good big pan would work), add a few diced up red potatoes, some spice rub, and a bit of garlic. cover, stirring every 5 minutes or so on medium high, til the potatoes are cooked through, serve with some BBQ sauce or ketchup, or, if we're in a sweets mood, maple syrup. It's a frequent go to in our house!
Brown rice with soy sauce and sesame oil, a few of last night's veggies and maybe a little canadian bacon thrown in for good measure. I like to add an egg, but obviously that's out for you.
Avocado on toasted bread is lovely when the avocados are good. This would be good with a few slices of bacon too.
Pigs in a blanket are great, you could either use pancakes or some sort of dough in a can.
Cheesy scones would be wonderful.
My standard breakfast is a bowl of fruit with yogurt and a side of dry cereal for crunch.
Smoothies are also great.
Avocado toast is a good savory one. Or a Turkish breakfast (without the boiled egg): some combination of bread, olives, feta cheese, cucumbers, and tomatoes, eaten cold. Yum.
If you prefer non breakfast foods anyway, feel free to eat that turkey sandwich or spinach salad at breakfast. The point of breakfast is just to eat something healthy to start your day. Any healthy option from lunch or dinner is perfectly viable.
I'm in the same boat you're in...and I was totally inspired by the breakfast menu when I was eating at Hugo's in West Hollywood last week. I had posole for breakfast! It was awesome! I can't wait to make it at home.
Here's a link to their menu: http://hugosrestaurant.com/menu/breakfast-ala-carte
I had the same problem, and I've been making the most delicious breakfasts and haven't got sick of it yet. I toast up some sourdough bread, spread on tahini, avocado, cherry tomatoes and sprinkle salt and pepper, then crumble some goats cheese on top and snowpea sprouts or baby spinach!
i make something i call "breakfast soup" which is essentially just cereal microwaved til soupy and hot. then i top it with fruit and granola or extra cereal for "croutons"
I am on low GI diet and have found I LOVE bulgar wheat, mint flakes, dried cherries and roasted salted cashews sprinkled on top.
I also like rye crisp crackers and hummus with kalamata olives, too. And pea soup with oat bran sprinkled on top is amazing, too!
(& bonus, in 14 days I've lost almost 6 lbs & feel great ditching gluten, dairy, sugar & nightshade family)
I guess I naturally prefer savory for breakfast! Roasted sweet potato and dried cranberries is great for dessert, though.
plain soy milk with a little cacao, berries, nuts, and/or whatever fruit is in season
I've been on a creamy polenta kick the past few mornings. My favorite so far had parmesan, crushed pistachios, a little butter and lots of fresh black peper. Peanut butter and brown sugar is nice for something sweet.
I have the same problem! I prefer savory breakfasts, but I HATE eggs. I love Israeli (or Israeli-style? I've never been) breakfasts with hummus, cheese, olives, bread - it's clean and light but filling. Also have been wanting to try Mark Bittman's savory oatmeal recipes: <http://www.seriouseats.com/recipes/2009/01/mark-bittmans-savory-oatmeal-with-scallions-and-soy-sauce-recipe.html>
Baked peaches that were drizzled with honey before going in the oven, topped with roasted almond praline and a mascarpone/double cream mix. Delicious!
I agree with the commenters who say breakfast is just a third meal.
The only thing I keep in mind for breakfast foods is how quickly they can be assembled. After that, the possibilities are endless. Though you mention dislike for certain breakfast starches, if you don't mind savory, there's always a slice of toast with a bit of pesto and cheese on top.
Like @fab, I like rice with soy sauce and sesame oil. As a kid, my mom would wrap it in pieces of toasted seaweed so that I could eat it on the way to school. Lately I've been using oatmeal instead of rice, and tossing in a handful of arugula into the pot the oatmeal is cooking in.
And don't underestimate the appeal of leftovers!
Grilled tomatoes, mushrooms (and bacon, if you can eat it) on toast. Maybe add spinach. Mmmmm.
German breakfast!! Small hard roll with cheese, wurst, salami, cream cheese, hard cheese, or quark, etc..
Another vote for polenta, with greens and cheese
Building off KillaCook middle eastern inspired breakfasts of pita, Za'atar, israeli salad (a cucumber tomato salad with an olive oil dressing), as well as hummus or ful (fava, very popular in egypt) and yogurt cheese are great (especially for spring and summer mornings).
Mark Bittman loves savory grain based breakfasts and has many recipes (on the minimalist site and his cookbooks). He also has the alternative pancake recipes (corn meal and pine nuts and oatmeal) that walk the line between savory and sweet.
My favourite is an Indian dish called Upma. Just a little bit of oil, splutter some mustard seeds, add curry leaves, green chilli cut in half and some broken cashews. Put the kettle on to boil some water. Roast off some coarse semolina (as much as you like, I don't measure!), keep stirring so it doesn't burn. You could add a chopped tomato if you like. Once the semolina just starts to change colour, crush in some ginger, add the tomato, some salt and add the boiled water. Mix in to make sure there are no lumps. The consistency should be quite thick, moist but definitely not too runny.
Eat hot!
*my fav is a pita bread wrap with labneh, cucumber spears, olive oil and s&p
*or as someone stated, Israeli style with bread, cheese, olives and cucumber/tomato salad
*avocado, tomato, mayo, s&p open faced sandwich
*toast with salted butter and creamed honey
thanks everyone! I have no issue going savory in the morning, but I find I end up bored with or wanting something super sweet for dinner. I do LOVE the idea of naan, yogurt and a pickle of some sort.


text:
October, 2013
Great looking hair starts with a healthy scalp. Prevent hair loss, remove excess build-up and stimulate new growth with these NEW organic haircare products from John Masters Organics. Used in the brand's signature Shiatsu Scalp & Hair Treatment, these effective grooming products will ensure your scalp is at its healthiest all year round.
Recommended for people experiencing hair and scalp issues
The early signs of aging hair
• Thinning hair
• Hair loss
• Damaged hair
• Dry hair
• Frizzy hair
• Split ends
• Lack-luster hair
• Limp hair
• Unmanageable hair
• Premature gray hair
• This system is beneficial for consumers who are having hair and scalp issues, whether
it be limp, unmanageable hair, hair loss, damaged hair, itchy, flaky scalp or dandruff.
• These products can be used individually or as a 3-step system.
john masters organics scalp system method
Achieve & Maintain Beautiful Hair With This 3-step Scalp & Hair Renewal System
1. cleanse
Key points:
• Removes dirt & oil
• Prevents inflammation and keep
scalp healthy
• Controls excess sebum production
2. treat
Key points:
• Softens and nourishes the scalp
• Alleviates inflammation
• Brings scalp back to its natural pH
3. stimulate
Key points:
• Stimulates hair growth
• Promotes blood circulation for
optimal scalp conditions
• Builds volume in hair


text:
Newegg is offering a big discount on this Lenovo IdeaCentre Q150 (40812GU) Intel Atom Nettop for only $319.99 – $30 Instant Discount + Free Shipping = $289.99!
If you're looking for a desktop PC smaller than you ever thought possible then check out this "'Nettop' from Lenovo! This IdeaCentre Q150 Computer gives you the smallest form factor you can find while still packing the capabilities you need from a system. It is powered by an Intel Atom D525 Dual-Core 1.80Ghz Processor along with 2GBs of DDR2 Memory for multitasking abilities. Regardless of the size it also maintains a large 250GB SATA 3.0Gb/s Hard Drive, nVidia ION Graphics and Wireless b/g/n connectivity. It also includes a USB keyboard and mouse.


text:
True Chews Beef Bully Braids and Spirals add more fun to chew time. The grooves and edges of these fun shapes help cleanse and freshen teeth while chewing. Your dog will love them because they're slow-roasted to lock in their natural flavor and chewiness. You'll love them because they're an odor-free, 100% natural dog chew that will help keep your dog occupied and happy. Tyson's American-sourced, American-made Beef Bully Sticks are made rawhide-free and without fillers. They're a naturally delicious dog chew you can feel good about giving. Your dog will thank you!
As with all chewing products, supervise your dog and provide fresh drinking water with this chew.
As with all chewing products, supervise your dog and provide fresh drinking water with this chew.
INGREDIENTS: Beef Pizzle, Natural Smoke Flavor.
2 Review(s)
per page
- Great product Review by Katherine
Your Rating
Our dog LOVES these Bully Braids. (Posted on 9/27/14)
- Good chew treat! Review by Noodles55
Your Rating Product Tyson True Chews 6 inch Beef Bully Braid 50ct (2 x 25ct)
Very good chew treat. (Posted on 8/10/14)
2 Review(s)
per page


text:
This is a song that has the singer imagining a situation where his baby leaves him. He paints a gloomy picture should that happen in it will rain lyrics by opting for a pain killer as a medication for what will befall him. To him what they have now but wouldn't have then will be hard to live without. In the song the singer shows how such a thought is unimaginable and that no spiritual remedy would be enough to save remedy.
There is no belief in the power prayer when he says the longest time spent on his knees wouldn't change anything for the better after the estrangement. While lost without you lyrics dwell on the singer's inability to move on, it will rain's words has the singer reminding his baby about the sacrifices he is making so that he can keep her always on his side. Sacrifice is what he does to keep her from walking out the door.
Like in lost without you lyrics our man proclaims to his darling in case of a parting "there will be no sunlight". There would also be no clear skies if he ever lost his baby. He drives his message by comparing clouds to the clouding in his eyes. The result will be the raining of tears from his eyes like the cloud does rain, rain and rain. He concludes by telling her that he would care for her happiness the same way her parents would.


text:
New Video Sharing Website for Musicians - Calsbay.com
Calsbay Media Promotions has launched a website in which its objective is simply to get artists and promoters exposure! They realize that there is so much talent in the world and that no one should be discouraged when it comes to pursuing one's dreams. Their job is simply to get the word out that you have ARRIVED! This site is strictly for musicians, comedians (iennes), spoken word artists, agents, managers and promoters.
Not only does Calsbay Media Promotions put a lot of effort into marketing the site: http://www.calsbay.com/, they apply the same efforts in to getting exposure for the site's Artists and Promoters. The good thing for Artists is that at Calsbay.com there are no contracts to sign. When an artist gets discovered there will be nothing holding them back.
Artists Exposure ranges from business cards, flyers, brochures, digital outlets distribution, email blasting, press releases, radio, and web presence to celebrity workshops and television. There is no cost to Artists and Promoters to use the site and uploads of music, videos and photos are unlimited.
Independent Artists are given the opportunity to get paid from music downloads, ring tones, MP3 websites, gig referrals and other means through Calsbay.com networking. We also have a monthly contest which gives our Artists the opportunity to get paid.
Calsbay.com also provides support to music promoters. Site creator Calvin Gribble and site advisor Michael Roche collectively have over 20 years experience in being part of the Management Team of one of the most successful venues in the world: MGM Grand Arena in Las Vegas, Nevada.
They have collectively overseen the success of hundreds of major productions such as the Billboard Awards, Mick Jagger and the Rolling Stones, Celine Dion, Janet Jackson, Justin Timberlake, Britney Spears, The Kings of Comedy, Barbara Streisand and much, much more. The list goes on. They both take pride in their diligence in making sure that each and every event that they take part in is aimed in the direction of success. Not only do they both have the experience in operations supervision and management ... they both have technical experience in the form of conversion, stagehand, A/V, sound, lighting, set design, rigging and electrics.
What do you think? ▼
- http://www.facebook.com/profile.php?id=100000583457518
- http://www.facebook.com/profile.php?id=637189872


text:
Categories > Anime/Manga > Full Metal Alchemist > Betrayal
It Begins0 Reviews
A dance, a betrayal, a jealous edward, what will happen? read to find out.
chpt. 1- It begins
It was a beautiful spring afternoon when Winry Rockbell arrived in Central after a very long train ride. She had come to yet again fix Ed's automail. When she finally arrived at Central HQ, she overheard some female officers talking about a big spring ball taking place the following day. "Oh, I can't wait! it's going to be so much fun!" one of the girls said. -Dance huh?-Winfy thought to herself. She had never really been to a dance, much less a ball. She would never tell, but she always secretly wanted to dress up in a beautiful dress, and go to a ball with her dream guy(which just happened to be Edward). "Winry!" someone called out, causing her to break free of her thoughts.
"Al,Ed,hi!" she called to the two boys heading her way. "Long time no see, huh?" Al said. "Yeah, it has been a while." Winry replied. "So, i heard something about a ball tomorrow, are you going?" "I don't know about Al, but i'm required to go, AND i have to bring a date!!! Ed said. Al looked at his brother and chuckled. "I don't know niisan, I think it might be kinda fun. Maybe you could take Win-" "Okay!" Ed interrupted. "I'm hungry, you want something Win?" "Uh,sure." she replied. -Great- She thought to herself. -He doesn't want to go, much less with me- "Win, you coming?" Ed asked. "Yeah, i'll be right there." She answered quietly.
A/N// Yeah so, this is an experiment with chapters. If it sux, please feel free to suggest anything. Don't be lazy R&R!!! please no flames...


text:
Categories > Celebrities > My Chemical Romance > Lipgloss Through My Veins
Chatper Five3 Reviews
Mikey, Ray and Bob go over for some drinks to Scarlet and Asha's house
"Come on Gerard! Just come out tonight." Mikey pleaded with his older brother.
"How many times do I have to say it? NO!" Gerard replied taking a drag of his cigarette.
Gerard was a hermit. He rarely left the house and spent all his time in the basement he had made into a bedroom, just drawing. He saw no point to going out and interacting with people. People were cruel and judgemental. St least the dozens of characters he created and surrounded himself with, didn't do that. They merely sat there, silent, doing what he demanded them to.
"But Gerard, it's not like we're going out out ya know. We're just going to my boss' house for some drinks. If you won't come out to spend time with me, will you at least come out and make me look good in front of my new boss. Please Gerard?" Mikey begged.
"Maybe next time." Gerard said getting up from his chair at the kitchen table.
"Gerard. You ALWAYS say that!" Mikey said slightly irritated.
"Fine Mikey. But I really don't feel like going out tonight. But next weekend I'll come out. I promise." And with that he fled down to the basement, his one and only escape from the world.
Mikey just sighed and left to go and get ready.
Just as she had suspected, Asha took a forty five minute shower, leaving little time for Scarlet to get ready, as per usual. She quickly showered and slipped into her black and white striped sweats and her black mini hoodie with a white singlet underneath. She ran a brush though her hair and then tied it up in a loose bun. Scarlet didn't really feel like dressing up, after all they were just going to be sitting around having drinks, they weren't going anywhere. After checking herself in her mirror she proceeded downstairs to start drinking. Asha and Scarlet were expecting Mikey and his friends in a few minutes.
"Not the mini hoodie!" Asha said from the kitchen in a disappointed tone.
"How the hell did you know that? You can't even see me from where you are!" Scarlet said as she made her way down the stairs completely out of view from the kitchen.
"I can hear it. The mini hoodie makes a certain noise when you wear it. It calls out, I can't believe you can't hear it. It says "I'm a pointless article of clothing, and you shouldn't wear me." You should really listen to it ya know!" Asha laughed exiting the kitchen with two Bloody Marys, one for herself and one for her friend.
"You talk a whole lot of shit you know that. And there's nothing wrong with my mini hoodie. I love my mini hoodie!" Scarlet said taking her drink from Asha a having a sip.
Asha hated mini hoodies. She thought they were totally pointless. "What's the point of having a jumper that only comes up to underneath your boobs? That's not keeping anything warm! It's like sleeveless turtlenecks, if you need to keep your neck warm, you clearly need to keep your arms warm too!" Asha exclaimed.
"Shut up and drink up!" Scarlet said motioning towards Asha untouched drink.
Scarlet and Asha loved Bloody Marys. That was their drink of choice not only because they tasted good but also because they got them very drunk, very quickly. The only bad thing about Bloody Marys was the fact that because they were made from mainly tomato juice, if you drank too much and threw up, your puke would be a bright red colour. The first time Scarlet drank Bloody Marys and got sick from them she thought she was throwing up blood because of the colour of her vomit and freaked out. She was too drunk to realise that it was just the tomato juice in the numerous drinks she had had that night.
Mikey and his two friends Ray and Bob finally arrived at Asha and Scarlet's house. Bob had driven them and had planned to not have too many drinks so he could drive them all home later. The three guys walked up to door and Mikey rang the doorbell.
The guys could hear what sounded like an extremely large dog barking like crazy from inside the house.
"Misfit, shut the FUCK up!" They heard a female voice scream from the other side of the door.
The guys just looked at each other and burst out laughing.
Finally Asha answered the door.
"Hey guys, welcome to our humble abode. Come on in." Asha said opening the door completely allowing Mikey and his two friends in.
Asha lead the boys inside and into their living room where Scarlet was sitting back, sipping on her drink.
"Hey Scarlet how are ya?" Mikey said shyly. He wasn't quite sure how to approach Scarlet just yet.
"Hey honey. Long time no see huh?" Scarlet said jumping up and embracing Mikey. She could tell he was feeling overwhelmed and slightly uncomfortable so she thought a hug from her would be enough to settle him down a bit.
"Not too bad." Mikey said hugging Scarlet back, feeling more at ease then before.
"Oh, and these are my friends Ray and Bob." Mikey said motioning towards his two friends as they all sat down.
Ray gave Scarlet and Asha a small smile and a wave, clearly a more reserved type of guy although his hair said something completely different about him. He had a huge mop of brown curls that could easily be called an afro. No one had hair like that unless they wanted to stand out, but Ray seemed very quite making the mix between his looks and personality extremely weird. Bob on the other hand got up to shake Asha and Scarlet's hands. He looked like a bit of a tough guy. He was big and stock with blonde hair and a lip piercing. Although he portrayed this "big bad wolf" image, there was a kindness in his bright blue eyes that made Scarlet feel more at ease with him.
"And who might this be?" Mikey said as Misfit leapt up onto his lap crushing his tiny frame.
"Oh, that's Misfit. Come here Misfit. Sorry, he thinks he's a poodle." Scarlet laughed pulling her dog off of Mikey by his collar.
"He's adorable!" Bob gushed over him. He whistled to Misfit who immediately responded to his call, bounding awkwardly over to his new companion.
"Nice name. You into the Misfits?" Ray asked.
"Yeah, we both love them. Halloween and Astro Zombies and like two of my most favourite songs ever!" Scarlet squealed.
"Yeah, I love them. Great music." Ray replied.
"So. Maybe we should get some drinks into you boys and do something fun?" Asha said getting up from the couch and venturing off into the kitchen to grab the guys some beer.
The five of them just sat around and chatted about everything and anything as the night went on, sipping on their drinks as they went. Asha had been right, Mikey was a whiz kid with music, he knew EVERYTHING... and anything he didn't know, Ray knew. He was super smart and really passionate about music. Bob was just plain funny and within no time had consumed more alcohol then he should have.
"Bob you're drunk!" Asha laughed as she pointed at a swaying Bob.
"Noooo. You're drunk! I can drive home for sure!" Bob yelled back pretending he was in his car right then, working with the pedals and the steering wheel.
"You guys are crashing here tonight! No if or buts!" Scarlet said sternly. There was nothing in the world that she hated more then people who drunk drove. In her opinion, it was the stupidest thing anyone could possibly do.
"So now that you don't have a limit on how drunk you can get. Let's play a drinking game, and I know just the one." Scarlet smiled as she got off the couch and began searching through the first drawer of their wooden TV cabinet.
"Three man?" Asha asked.
"Of course it's Three Man!" Scarlet laughed.
"What the hell is Three Man?" Ray asked kind of confused.
"You've never played? Well hang on and get ready for a bumpy ride! This is the best drinking game ever." Asha said with a smile.
"Yeah, gets you totally maggot!" Scarlet said finally finding what she was looking for, a pair of dice.
"Maggot?" Mikey asked.
"Oh, don't mind her. She's from Australia and sometimes uses these weird Aussie words that don't really make sense. It's taken me five or so years to learn them all. Maggot means really really drunk." Asha said walking into the kitchen to get more drinks.
"Ah ha! Australian. I knew you had an accent. Just couldn't pin point it. I was thinking English or something." Ray said.
"Yeah, I get that a lot." Scarlet said setting the dice on the table and getting comfortable on her spot on the couch, ready to drink the boys under the table.


text:
Tuesday, October 1
Welcome to the District 31 Umpire Page
Scroll down to see information relating to umpires in District 31
Click on the "Clinics" tab to view umpire clinic information for 2013/2014.
Handout: Umpire Handouts
Monday, January 27
Umpire Registry open for 2014 season!
Little League® International's Umpire Registry offers Little League umpires an informative way to stay on top of their game. By joining the Umpire Registry, umpires immediately become part of a unique information network charged with enhancing umpire services for Little League players everywhere.
The Umpire Registry provides an opportunity for umpires to stay current with rules and regulations, and offer suggestions that will continually improve skills. Umpires can access the latest information on rule interpretations, regulations updates, and more. The Umpire Registry also offers tools through the Members Only website. As a member, you will have access to the Fairball newsletter, a quarterly publication that contains articles on rule interpretations, mechanics, and news concerning umpires; E-Rules; the Rules Instruction Manual (RIM); and 60 and 90 foot Field Mechanics Manuals.
The cost to join the Umpire Registry is $25 when registering online and $30 if the registration is delivered via standard mail.
One of the great benefits with membership is the Members Only "E-Rules" section. Here you have the ability to download the current electronic edition of the Little League Baseball®, Little League Softball®, and Little League Challenger Division® Rules. The electronic rulebooks allow users to search the rules electronically, making it easier and faster for umpires to find the information they need. And, just like the printed rulebooks, the E-Rules expire at the end of the year when Little League issues updated rulebooks for the coming season. Also available in the "E-Rules" section are 11 videos featuring common rules interpretations.
Whether you are new to Little League umpiring or a long-time veteran, the Umpire Registry is here to help you become a better volunteer umpire. Included in your membership is:
Register On-line Now for the Umpire Registry!
Or Download the Umpire Registry Form.
An added benefit to joining the Umpire Registry:
A new member's only section created specifically for Umpire Registry members. A copy of the latest Umpire School Rules Instruction Manual (RIM) is available for download as well as other sections of the 60 foot and 90 foot Umpire Instruction manuals. Archived version of Umpire Newsletter Fairball are also available.
Wednesday, November 20
Little League® Names New Director of Umpire Development
Stephen D. Keener, Little League® Baseball and Softball President and CEO, announced today the addition of Thomas Haines, Jr., Director of Umpire Development, to the Operations Department at Little League International in South Williamsport, Pa. "Some of our most important, dedicated Little League volunteers are our umpires," said Mr. Keener.
"We are thrilled to have Tom join our staff in Williamsport to provide support and structure for the men and women who give their time to ensure that all Little Leaguers® have a positive on-field experience."
After serving just less than 10 years on active duty in the United States Air Force, Mr. Haines worked professionally for a consulting firm in Northern Virginia. He currently serves as a traditional Guardsman for the Pennsylvania Air National Guard. A father of two Little Leaguers, Mr. Haines, 39, began umpiring in 1993 at the high school level. He became a Little League volunteer in 2009, predominately as an umpire, but also as a coach for a Senior League Baseball team in 2013. An umpire at the Virginia State Little League Baseball® Tournament in 2012 and 2013, Mr. Haines has also attended Little League Umpire Schools and Clinics in the Southeastern Region and at Little League Headquarters. Mr. Haines is also a former Board Member of the Virginia State Tournament Umpires Association.
As Umpire Development Director, Mr. Haines will assist with training and supporting volunteer umpires throughout the entire Little League International program. This will include overseeing the Little League Umpire School and Clinics, development of publications and educational resources and creating instructional curriculum.
A native of Lock Haven, Pa., and graduate of Mansfield University of Pennsylvania, Mr. Haines currently resides in Lock Haven with his wife and two sons.
Monday, September 23
New District 31 Staff Umpire announced
A new District 31 Staff Umpire was announced on September 23rd, 2013.
Congratulations are in order for:
Ryan Walker of Carmel Mountain Ranch LL
Tuesday, August 5
District 31 Umpire selected for Junior League Baseball Western Region tournament
Congratulations are in order for District 31 Staff Umpire, Dave Walker, on his selection as an umpire at the Western Region Junior League Baseball Tournament in Vancouver, Washington for 2014.
The tournament is a step before the Junior League Baseball World Series in Taylor, Michigan and is the championship for the West and NorthWest representative of the western United States.
The dates of the Junior League Baseball Western Regional are August 1 - 6.
Dave hails from Carmel Mountain Ranch Little League and was a former Umpire-in-Chief there. He continues to call games at leagues within District 31.
Click on the header above to be linked to the Junior League Western Regional tournament game schedule, results, information and map.
Crews are working 4 man through pool play.
Tue July 29 2pm S. Cal v. WA U3
Wed July 30 9am UT v. AZ U2
Wed July 30 3pm AK v. S. Cal U1
Thu July 31 9am WA v. AZ PU
Thu July 31 3pm HI v. OR U3
Fri Aug 1 12pm ID v. N. Cal U2
Fri Aug 1 6pm Host v. UT U1
Sat Aug 2 9am S. Cal v. AZ PU
Sat Aug 2 3pm AK v. NV U3
Sun Aug 3 12pm S. Cal v. HI U1
Sun Aug 3 6pm WA v. Host PU
Mon Aug 4 10am UT v. AZ LFL
Mon Aug 4 1:30pm S. Cal v N. Cal U3
Consolation game Tue Aug 5 1:00pm N. Cal v UT PU
Championship game Tue Aug 5 5:00pm S. Cal v AZ U2
Tuesday, October 1
2013/2014 Western Regional Clinics
The Western Region Clinic schedule for 2013/2014 has been finalized. Online Registration for all Regional Clinics is open October 1st, 2013. Payment will be by credit card only. If you don't have a credit card, you will need to call and register with the regional office at 909-887-6444.
Once registration is open, you can click on the header above to link to the registration page.
COMPLETED - Chief Umpire UIC "Train the Trainer" Clinic. December 6 - 8, 2013. (Note this clinic is in December now) This clinic is designed to instruct and train the Local League or District Chief Umpires how to plan and conduct rules and mechanics clinics for their own league or district. This clinic is a "Train the Trainer" type clinic and will provide the experience and knowledge for the league officials to return to their home league and facilitate their own clinics, while providing sufficient training and information for their local staff and volunteers.
Lead instructor: Mark Bernstein (Bud Mathews also instructing)
COMPLETED - Rules Instruction Clinic January 11 – 12, 2014 and January 25 – 26, 2014 There are two weekend clinics that focus on Little League Baseball and Softball Rules. The training offered, and the materials presented are outstanding. This clinic is open to all Little League Volunteers and all District Officials, including managers, coaches, and umpires regardless of experience. Minimum age is 18 years of age. This clinic is designed for the volunteer. The instruction is very professional, and students will receive knowledge to help them perform their duties at the local league and district level. This clinic will provide the experience and knowledge for league officials to return to their home league and provide sufficient training and information for their local staff and volunteers. This is a two-day clinic; with registration beginning on Saturday at 6:30 a.m. Class will begin on Saturday at 7:45 a.m., and conclude on Sunday at 12 Noon. Meals and instruction will be provided at the Western Region Headquarters complex
Instructors for first weekend: Gary Graupmann (D31) and David Lewis is instructing
Instructors for 2nd weekend: Gary Graupmann (D31) and Larry Gomez is instructing
COMPLETED - Weekend Mechanics Clinic January 24 – 26, 2014 This weekend clinic focuses on Plate and Field Mechanics. The training offered for the Little League Volunteer Umpire, and the materials presented are outstanding. This clinic is open to all Little League volunteer umpires regardless of experience. Minimum age is 18 years of age. The clinic is designed for the volunteer umpire. The instruction is very professional, and students will receive knowledge to help them with their umpire career. This clinic will provide the experience and knowledge for the league umpire official to return to their home league and provide sufficient training and information for their local staff. Meals and instruction will be provided at the Western Region Headquarters complex. Umpires must bring their plate gear for cage work (facemask, chest protector, shin guards, cup) and base shoes for field drills, dress is casual.
Lead instructor for weekend: Mark Bernstein (Dave Walker (D31) and Don Wolever (D31) also instructing)
COMPLETED- Adult Umpire Schools 1st Session February 8 – 14, 2014 Only one session available starting this year. Both Rules and Field Training are included and the materials offered are outstanding. Each student will receive ample videotaped plate instruction throughout the week. Includes dormitory style housing and all meals.
This session will fill up quickly, so register early if you want to attend.
Lead Instructor for weeklong: Mark Bernstein. (Gary Graupmann (D31) also instructing)
Tuesday, August 21
Teaching Life's Lessons
Teaching Lifes Lessons
Winning is a pleasant by-product of competition.
The responsibility of the Manager and Umpire includes developing the character of the young men and women as well as their playing ability. Educating young people includes how to handle adversity, maintaining grace in victory and dignity in defeat, and respect for the opponent as a fellow athlete and human being. There is no place in Little League for intimidation, humiliation or any other disrespectful or unsportsmanlike action towards each other, opponents or officials.
Losing provides the opportunity to teach important life lessons to everyone.
Managers must realize and teach players that losing is a part of the game and as long as everyone has done their best, it means that they just lost to a better team that day. They should also teach players that everyone makes mistakes from time to time. How they respond to calls on the field that go against their team will go a long way toward shaping their character.
It is solely the responsibility of the manager of the team to hold the umpires accountable for issues of safety and fairness. It is how they handle themselves in cases of adversity that teach players how to deal and handle difficult situations. Coaches and Umpires should be aware that players from both teams are watching how adults handle themselves and that their position as role models determines what the players learn from these experiences.
Umpires may have varying levels of tolerance for different situations. How they control each situation depends on experience and maturity. They must show respect to the manager and remain in control of every situation. If the situation develops into an ejection, the result must be controlled, calm and professional.
Sportsmanship is a crucial attribute that everyone must develop.
Umpires are the authoritative figures and have an equal, if not greater responsibility to that of the managers for modeling good sportsmanship. Competition may compromise managers from time to time, but the umpire must maintain control at all times. All adults must be role models and educators of character for the players.
The role of the umpire is to provide fairness for all player's managers and coaches. They should be in control and acting with a calm behavior and setting the example for everyone on the field.
Our society is becoming increasingly tolerant of profanity on the playing field. Little Leaguers must be taught against this disturbing trend. Any bad language or unsportsmanlike conduct should not be tolerated! Managers, players and umpires must refrain from these actions, hold each other accountable, and set the example for everyone on and off the field.
Bill Carter
Tuesday, January 24
Third Strike Umpire Mechanics
With the new dropped 3rd strike rule being used in Majors (and 10/11 and Majors allstars), Western Region has come out with recommended mechanics to use for third strike situations.
1. 3rd Strike CAUGHT: Indicate the 3rd strike with a 'Hammer Hand-Sign' (Stylized if the Umpire wishes), NO Verbal if Swinging, Verbal if Not Swinging. May be followed with a second hand-sign indicating the Batter is "OUT", NO VERBAL on OUT indication.
2. 3rd Strike DROPPED: Indicate 'Strike 3' with a 'Hammer Hand-Sign' (Stylized if the Umpire wishes). This hand-sign will be followed by a second 'hand-sign' indicating the pitch was DROPPED. Acceptable hand-sign is the normal "Safe Sign" or a modified Safe Sign with "Fists Closed", NO VERBAL on the 'dropped 3rd Strike' mechanic.
3. 3rd Strike DROPPED WHEN BATTER RUNNER CAN NOT ADVANCE: Indicate 'Strike 3' with a 'Hammer Hand-Sign' (Stylized if the Umpire wishes). Indicate BR is OUT with proper 'Hand-Sign'. If the BR starts to advance, follow the BR up the Base Line signaling "OUT" and verbalizing emphatically "He's Out... He's Out... He's still Out".
4. 3rd Strike DROPPED ON POSSIBLE CHECK SWING: Plate Umpire indicates verbally, "BALL... NO he didn't go". BASE UMPIRE "Immediately" indicates his intention to reverse the PU on APPEAL, by signaling "OUT" and verbally saying, "YES, he went... YES, he went...", or, "YES, he did... YES, he did..." NOTE: In this case, the Base Umpire does not need to wait for the Plate Umpire to ask "Did he go?"
Monday, September 23
District 31 Staff Umpires
Wednesday, September 26
D31 Umpire Consultant, Mark Bernstein, inducted into San Diego Hall of Champions
Integrity – Leadership – Character
San Diego Hall of Champions
September 25, 2012
District 31 Umpire Consultant and former UIC, Mark Bernstein, was inducted into the San Diego Hall of Champions San Diego County Sports Officials Hall of Fame. His biography is listed below.Mark Bernstein – Youth Sports
Mark – born and raised in Queens, New York – began his Little League umpiring career at Mid-Queens Boys Club Little League in New York at the age of 16 and has just completed his 36th consecutive year of Little League umpiring.
Mark is a two-time Little League World Series umpire – in 2002 and 2008. He has also worked three LLWS regional tournaments in Sacramento (1995), San Bernardino (1999) and the European Regional in Kutno, Poland in 2000. During his long career, Mark has also worked countless state tournaments in California, Arizona and Nevada.
In addition to his work on the field, Mark has been a lead trainer for both Umpire Rules and Mechanics at the Western Region of Little League Baseball and Softball since 1994, and an umpire supervisor since 2002. He was also at the forefront of the establishment of the Western Region Little League Umpire Alumni Association in 2004, where he was President from inception until relinquishing the reins in 2012. His simple mission statement: "By Umpires for Umpires."
Also included in the Class of 2012 were Tom Wood - Basketball; Andrew Castagnola - Football, Mike Winters - Baseball and Patrick Russell - Boxing.
Mark started off his acceptance speech with a Basic Two (Ball & Strike calls) that the 50+ Little League umpires in the audiance nailed!
Mark's speech was nothing if it wasn't inspirational. The complete text of the speech is in the handout below. All of those who were in attendance urge you to take the time to read it.
One of the later speakers bet everyone there that he would buy them an adult beverage if they ever officiated a game for less that the six dollars he received for his first game. All of those 50+ volunteer LL umpires raised their hand. He rescended his offer! A great Little League moment.
A special night for Mark and his family; a special night for his friends in attendance; and Mark made it a special night for Little League.
California District 31


text:
This excerpt is from The ActionScript 3.0 Quick Reference Guide. If you're ready to give your Flash projects a considerable performance boost, learning ActionScript 3.0 is a must. This Quick Answer Guide is designed specifically to help Flash designers and developers make the leap from ActionScript 2.0 to the new object-oriented ActionScript 3.0 quickly and painlessly. You'll learn key differences between the two language versions, allowing you to more easily leverage ActionScript 3.0 using Flash CS4 and other Adobe technologies like Flex and AIR.
Table of Contents
You'll typically find it fairly straightforward to choose which version of ActionScript to use when you start a new project. You usually decide based on which version of the Flash Player you're trying to target, the need for enhanced performance, or a specific feature you wish to use. Deciding what to do with existing projects, however, is another matter. Often you need to determine whether or not it's worth the time and effort to migrate to ActionScript 3.0 from a prior version of the language, or just to start over.
You can't easily determine what to do; each project's characteristics probably significantly affect your decision. The clarity of your existing code, the extent to which you use particular features, project size, and your comfort level, among other factors, help you decide.
This chapter walks you through a small-scale, manufactured example of a migration from ActionScript 2.0 to ActionScript 3.0. Read the text linearly, as code isn't always explained in detail twice. It is very important to understand that this example isn't a demonstration of real-world best practices at work. This example is significantly constrained, and attempts to insert as many migration issues as possible into its tiny footprint. Throughout the example, what may appear to be odd choices, poorly optimized code, or even mistakes, have been intentionally injected into the code to either set up a migration task or bring the two versions into a parallel structure.
For example, objects are added out of order intentionally to demonstrate depth management, different methods of providing or checking default values have been used, objects are created in a variety of ways, both component and custom buttons are used, function/method placement isn't consolidated, and so on. The project demonstrates both timeline- and class-based coding, but is by no means an example of good object oriented programming practices. The class and timeline are coupled too tightly, to mention one example.
If you remember that this scenario is artificial, designed to illustrate migration issues, it may help you form a plan or checklist of sorts to help when it comes time to update your next legacy project.
This representative example creates a particle system that performs a few basic tasks. At startup, it plays an ambient audio loop. It then attempts to draw a blue square particle upon each enter frame event, based on a simple conditional. If successful, the particle moves away from the center of the stage, rotating and fading to transparency. Each time a particle is created, its name is added to a text field.
Finally, two buttons add functionality to the system. The first opens a web page. The second selects the previously created particle, replaces its content with a larger red square, and plays a new random sound. The altered particle affects its associated sound, panning based on the particle's position, and fading based on the particle's alpha.
Both examples require a custom button with a linkage of "BtnLink" and a Button component. The ActionScript 2.0 FLA file also requires an empty movie clip called "Particles." These assets are provided in the downloadable source files (see Preface).
To start, the complete ActionScript 2.0 code will be presented, with numbered lines. The project features a single class used by a brief frame script in the main timeline. This structure helps demonstrate migration issues related to the use of classes, as well as general syntax. Discussion of each script follows, with a general explanation following the ActionScript 2.0 code, and migration comments following the ActionScript 3.0 code.
The main timeline builds the user interface, and creates an
instance of the
Particles class by
adding a movie clip to which the class is linked. The class does all the
work with the particles, and will be explained in a moment.
Production: The lines of code in this chapter contain turnover characters and soft returns to indicate that code lines are continued on the next line. The continued line should not have a line number. Robyn
1 import mx.controls.Button; 2 3 if (!imgURL) { 4 var imgURL:String = "bg.jpg"; 5 } 6 7 var txtFrmt:TextFormat = new TextFormat(); 8 txtFrmt.align = "right"; 9 var txtFld:TextField = this.createTextField("particleInfo", 1, 380, ¬ 10, 100, 380); 10 txtFld.setNewTextFormat(txtFrmt); 11 12 bg = this.createEmptyMovieClip("bckgrnd", 2); 13 bg.loadMovie(imgURL); 14 bg.swapDepths(txtFld); 15 16 var snd:Sound = new Sound(); 17 snd.loadSound("../audio/bass_back.mp3"); 18 snd.onLoad = function(success:Boolean):Void { 19 if (success) { 20 snd.setVolume(10); 21 snd.start(0, 100); 22 } 23 }; 24 25 var particles:MovieClip = attachMovie("Particles", "particles", 3); 26 27 var controls:MovieClip = this.createEmptyMovieClip("btns", 4); 28 controls._y = 360; 29 30 31 var linkBtn:MovieClip = controls.attachMovie("BtnLink","link", 5); 32 linkBtn._x = 20; 33 linkBtn.siteLink = "http://www.learningactionscript3.com/"; 34 linkBtn.onRelease = function():Void { 35 getURL(this.siteLink, "_blank"); 36 }; 37 38 var changePBtn:Button = controls.createClassObject(mx.controls.Button, ¬ "chng", 6, {label:"Change"}); 39 changePBtn.move(changePBtn.x + 120, 0); 40 function changeParticle():Void { 41 var p:MovieClip = particles["particle" + (particles.count - 1)]; 42 p.clear(); 43 p.beginFill(0xFF0000); 44 makeRect(p, -20, -20, 40, 40); 45 p.endFill(); 46 particles.particleSound(p); 47 } 48 changePBtn.addEventListener("click", changeParticle); 49 50 function makeRect(mc:MovieClip, xp:Number, yp:Number, w:Number, ¬ h:Number):Void { 51 mc.moveTo(xp, yp); 52 mc.lineTo(xp + w, yp); 53 mc.lineTo(xp + w, yp + h); 54 mc.lineTo(xp, yp + h); 55 mc.lineTo(xp, yp); 56 }
The following includes discussions of ActionScript 2.0 syntax, but also a basic explanation of the project—much of which applies to both ActionScript 2.0 and 3.0 versions.
Line 1 imports the
component class to make it accessible to the compiler.
Lines 3 through 5 check for the presence of a variable
imgURL, and then
initialize it to the URL of a background image in case no value
for the variable is found. This step lets you pass a path to a
background image into the project through the HTML host file. If
this feature isn't used, the hard-coded background image isn't
Lines 7 and 8 create a simple
TextFormat instance to right-justify
text in a field.
Lines 9 and 10 dynamically initialize a
TextField. Line 9 creates the field and
gives it an instance name of
particleInfo, places the field at a
depth of level 1, places the field at point (380, 10), and sizes
the field to a width of 100 pixels and height of 380 pixels. Line
10 applies the previously created
TextFormat to the field.
ActionScript 2.0 requires that you set a level for every asset added to your project. Asset levels are hard-coded in lines 9, 12, 25, 27, 31, and 38. This step requires either careful preplanning or arbitrary level assignment (buttons between 100 and 200, movie clips between 300 and 400, and so on) and a good memory.
You can determine the next available level for symbol
instances like movie clips, using the
getNextHighestDepth() method. However,
significant problems arise when adding components (which occurs
later in the script) because the
getNextHighestDepth() method can return
errant levels beginning with 1048576. Not only does this wreak
havoc with your level management, it's outside the valid level
range, making it impossible to remove assets dynamically.
To get around this problem, you can adopt the significantly
more confusing approach of using the
DepthManager class, created for managing
depths of Version 2 Components, generally making things more
Line 14 swaps the depths of the text field and background image, making the background image the bottom-most asset. The text field and background were added in reverse order to demonstrate this feature.
ActionScript 2.0 allows sloppy variable use such as not
declaring or typing the variable
bg in line 12.
Lines 12 and 13 display a background image. Line 12 creates an empty movie clip, and sets its depth to level 2. Line 13 loads the image.
Lines 16 through 23 play a background sound. Line 16 creates
an instance of the
Sound class.
Line 17 loads the sound.
Lines 18 through 23 create an event handler to process, in this case, a load complete event. Upon load completion, it sets the volume of the sound to 10 percent, so you can clearly hear other sounds atop this one, and plays the sound from the beginning, looping 100 times for longer play time. Another event handler appears in lines 34 through 36.
Line 18 uses
Void to tell
the compiler that no data's returned from the function. This
action occurs again on lines 34 and 40.
Line 20 manipulates a percent scale, and uses values between 0 and 100.
Line 25 creates an instance of a Library-based movie clip
with a linkage name of
Particles. It gives the clip an instance
name of
particles, and sets its
depth to level 3. Note here that the
Particles class responsible for particle
control can only easily be integrated into the project by
associating the class with a movie clip. This quality means that
you have to have at least an empty movie clip in your Library,
already set up with the appropriate class name.
Alternatives to this approach include manipulating the movie clip prototype, which is a bit messy and very difficult to bring forward into ActionScript 3.0, or switching to object-oriented techniques and using composition. Both approaches are significantly more involved than relying on a Library symbol.
Lines 27 and 31 also dynamically create movie clip instances. Line 27 creates an empty container (positioned in line 28) to hold buttons, and line 31 creates the first of two buttons, the functionally of which is discussed next. Both lines hard code depths, to 4 and 5, respectively.
Finally, line 38 also dynamically creates a movie clip equivalent, in this case a component. This step is relevant because, in the space of a dozen or so lines of code, you see three separate ways, each with unique characteristics, to place visible content on the stage.
Line 28 demonstrates that the movie clip's
_y property, like most properties in
ActionScript 2.0, is preceded by an underscore.
Lines 31 through 36 add a Library-based custom button with a
linkage name of
BtnLink to the
project. Line 31 places it into the controls
movie clip, gives it an instance name of
link, and sets its depth to level
Line 32 positions the x location of the button. The y location remains 0, and appears to be 360 because the button is in the controls movie clip—which, itself, appears at a y location of 360.
Lines 34 through 36 add a mouse release event handler to the button.
Line 33 dynamically creates a property called
siteLink, and then populates it with a
string. This step's really nothing more than a variable, but here
it's an example of dynamic versus sealed classes. In ActionScript
2.0, you could add properties to instances of most classes, even
though this practice wasn't recommended. In ActionScript 3.0,
however, most classes are sealed, meaning you can't dynamically
alter them in this way. You can use this approach only with select
dynamic classes in ActionScript 3.0.
siteLink property is
being added to the button, which you can't do in ActionScript 3.0.
The the section called "ActionScript 3.0" discusses why this example
was included, and also discusses another more directly analogous
Line 35 opens a URL in a new window, getting the URL from
siteLink property of the
button to which the event handler is attached.
Lines 38 through 48 add and empower a Button component. (As with a custom asset, a Button component must be in your Library.) Two different kinds of user-clickable objects demonstrate both the use of movie clips and the use of components.
Line 38 adds the button to the
controls container movie clip, gives it
an instance name of
chng, sets
it depth to level 6, and gives it a label of "Change." Line 39
uses the button's
move() method
to set it to an x position of 120, leaving the y position at 0, to
be affected by the position of the parent container. The
extraneous use of the
property (rather than setting the value to 120 directly) is to
show that ActionScript 2.0 v2 components use properties without
underscores, contrary to other properties.
Lines 40 through 48 apply an event listener to the button.
Lines 40 through 47 define the function triggered by the button's
click event, set in line
Lines 41 through 45 are discussed in the following
paragraphs, and line 46 triggers the
particleSound() method of the selected
particle in the
Line 41 creates a reference to the previously created
particle by accessing the movie clips within the
particles movie clip and finding the
particle by instance name. The instance name is built with the
"particle" and the
number of the current particle minus 1.
Lines 42 through 45 clear the contents of the particle, create a red fill, call a function that draws a centered, 40 × 40 pixel rectangle in the selected particle, and close the fill.
Lines 50 through 56 use the
lineTo() and
moveTo() methods to draw a rectangle, as
drawRect() method doesn't
exist in ActionScript 2.0.
Particles class creates
each particle, establishes its behavior, and ultimately removes it from
the project.
1 import mx.utils.Delegate; 2 3 class Particles extends MovieClip { 4 5 private var _count:Number; 6 private var _soundNum:Number = 0; 7 private var _tempSound:Sound; 8 9 public function Particles() { 10 _x = Stage.width / 2; 11 _y = Stage.height / 2; 12 13 _tempSound = new Sound(); 14 _tempSound.loadSound("../audio/note0.mp3"); 15 _tempSound.onLoad = Delegate.create(this, ¬ onSoundPreloaded); 16 } 17 18 private function onSoundPreloaded(success:Boolean):Void { 19 if (success) { 20 if (_soundNum < 7) { 21 _soundNum++; 22 _tempSound.loadSound("../audio/note" + _¬ soundNum + ".mp3"); 23 } 24 } 25 } 26 27 private function onEnterFrame():Void { 28 makeParticle(0x0066CC, Math.random() * 10 + 10); 29 } 30 31 private function makeParticle(col:Number, ¬ size:Number):Void { 32 if (!col){ col = 0x003366; } 33 if (!size){ size = 20; } 34 35 if (Math.random() * 10 <= 2) { 36 if (_count == undefined) { _count = 0; } 37 38 var p:MovieClip = this.createEmptyMovieClip("particle" + _¬ count, this.getNextHighestDepth()); 39 _count++; 40 p.beginFill(col); 41 _parent.makeRect(p, -size/2, -size/2, size, size); 42 p.endFill(); 43 44 p.xVel = Math.random() * 10 - 5; 45 p.yVel = Math.random() * 2 - 1; 46 p.onEnterFrame = onRunParticle; 47 48 _parent.txtFld.text += p._name + "\n" 49 _parent.txtFld.scroll = _parent.txtFld.maxscroll; 50 } 51 } 52 53 public function particleSound(p:MovieClip):Void { 54 if (!p.snd && _soundNum > 0){ 55 var num:Number = int(Math.random() * _soundNum); 56 p.snd = new Sound(); 57 p.snd.loadSound("../audio/note" + num + ".mp3"); 58 p.snd.onLoad = function(success:Boolean):Void { 59 p.snd.start(); 60 } 61 } 62 } 63 64 private function onRunParticle():Void { 65 var p:MovieClip = this; 66 p._x += p.xVel; 67 p._y += p.yVel; 68 p._rotation += 5; 69 p._alpha -= 2; 70 71 if (p.snd) { 72 p.snd.setVolume(p._alpha / 10); 73 p.snd.setPan(p._x / this._parent._x * 200) 74 } 75 76 if (p._alpha <= 0) { 77 p.removeMovieClip(); 78 } 79 } 80 81 public function get count():Number { 82 return _count; 83 } 84 }
The following features a brief explanation of particle behavior. Where appropriate, comments have been added to address ActionScript 2.0-specific concepts and, occasionally, to explain decisions made to demonstrate migration issues. Basic syntax issues discussed in the main timeline aren't mentioned again.
Line 1 imports the
Delegate class to make it accessible to
the compiler.
Lines 3 and 9 make up the key elements of the ActionScript
2.0 class structure. You'll see later that ActionScript 3.0 begins
a class with the
identifier. Line 3 shows that this class extends
MovieClip. (It's linked to a Library
movie clip.) The class constructor beginning on line 9 centers the
particle system on the stage, and creates and preloads the first
particle-specific sound.
Lines 5 through 7 create class properties but only initialize one. This step factors later into the use of default values.
Lines 5 and 6 use the
Number data type for integer counters
because no other number data types are available. You can also see
this property in lines 31 and 55. The value assigned in line 55,
as a good example, is always an integer, but must still be typed
Line 15 assigns the
onLoad() event handler for the sound
created and loaded in lines 13 and 14, respectively.
Delegate is used here, however, to
demonstrate that ActionScript 2.0 does not have method closures.
Due to this setup, the
class must pass the relevant scope to the event handler for it to
access the needed properties.
To prevent delays when triggering sounds later, lines 18
through 25 load seven additional sounds, but don't play them. The
name of the audio file contains indices 0 through 7. The first
note0.mp3, was loaded
in the class constructor, so the
soundNum property is incremented before
the load.
Lines 27 through 29 demonstrate that, because this class
MovieClip, ActionScript
2.0 lets you create a method for a movie clip event handler,
without any further assignment. That is, because the method has
the same name as a
event handler, it's executed upon every movie clip enter frame
event. This method attempts to create a blue particle that's
between 10 and 20 pixels square.
Lines 31 through 51 create each particle. Individual aspects of this function will be discussed in separate headers, but the basic creation process is as follows. Line 35 checks to see if a newly created random number between 0 and 10 is less than or equal to 2. If so, it creates the particle. This action both prevents a particle from being created on every enter frame, and adds a nice feeling of randomness to the process.
Each particle is drawn into an empty movie clip, with its
depth set to the next highest available level. It's given an
instance name of
N is an integer from the
_count variable, incremented each time a
particle's created. A fill of the color passed into the method is
created, a rectangle is drawn using the
makeRect() function discussed in the
main timeline (using the size passed into the function), and the
fill's closed.
Next, random x and y velocities are chosen for each
particle, providing movement between 5 and −5 for x and between 1
and −1 for y. The
onRunParticle() method is then assigned
as the enter frame event handler for each particle. (This step's
in contrast to the enter frame event handler assigned at the class
level that creates the particles.)
Finally, the name of the particle, and a subsequent new line, are added to the text field in the main timeline (the particle's parent). This step is discussed in detail in the upcoming note, "Manipulating Text Fields."
Lines 32 and 33 validate the argument values of
col and
size, assigning values if none are
found. ActionScript 2.0 has no built-in mechanism for assigning
default values in functions. As such, you must assign them
Further, line 36 checks for a value of
undefined in
_count and, if found, initializes the
property to 0. This demonstrates a change in the way ActionScript 3.0 handles default
values, and this is also why
_count wasn't initialized in line
Lines 41, 48, and 49 all access objects in the parent, in this case the main timeline.
The name of the particle, and a subsequent new line, are added to the text field in the main timeline (the particle's parent). The text field is then scrolled to the bottom line so you can always see the newly added name.
Lines 53 through 62 create and play particle-specific sound.
A validation first tests to be sure a sound for this particle
doesn't already exist, and that at least one sound has preloaded
(via the incremented counter in line 21). If so, a random number
is chosen from the current number of preloaded sounds (line 57)
and a new sound is created and stored in the
snd property within the current
particle. The random sound is then loaded and played upon load
(Many people consider it a best practice to group private and public methods (and properties). However, this method's optional, and has been neglected in order to arrange this example in a slightly more linear fashion for easier explanation.
Lines 64 through 79 establish the independent behavior for each particle. For each enter frame event, lines 66 and 67 add the x and y velocity values to the particle's location, line 68 rotates the particle 5 degrees, and line 69 reduces the alpha by 2 percent.
Lines 71 through 74 controls particle-specific audio. The volume and pan of the sound are set according to the particle's alpha and x coordinate, respectively.
Finally, lines 76 through 78 remove the particle when its alpha is less than or equal to 0.
The last three lines of the class create a getter that
returns the value of the
property when requested, as seen in line 41 of the main timeline
frame script.
The following are the ActionScript 3.0 versions of the two previous scripts. Only language version-specific comments are included here so, if you're unclear on overall functionality, see the equivalent ActionScript 2.0 section.
The following is the main timeline frame script.
1 import fl.controls.Button; 2 3 var imgURL:String = "bg.jpg"; 4 if (root.loaderInfo.parameters.imgURL) { 5 imgURL = root.loaderInfo.parameters.imgURL; 6 } 7 var txtFrmt:TextFormat = new TextFormat(); 8 txtFrmt.align = TextFormatAlign.RIGHT; 9 var txtFld:TextField = new TextField(); 10 txtFld.x = 380; 11 txtFld.y = 10; 12 txtFld.width = 100; 13 txtFld.height = 380; 14 txtFld.defaultTextFormat = txtFrmt; 15 addChild(txtFld); 16 17 var bg:Loader = new Loader(); 18 addChildAt(bg, 0); 19 bg.load(new URLRequest(imgURL)); 20 21 var snd:Sound = new Sound(); 22 snd.load(new URLRequest("../audio/bass_back.mp3")); 23 snd.addEventListener(Event.COMPLETE, onSoundLoaded, false, 0, ¬ true); 24 function onSoundLoaded(evt:Event):void { 25 var sndChannel:SoundChannel = new SoundChannel(); 26 sndChannel = evt.target.play(0, 100); 27 var sndTransform:SoundTransform = sndChannel.soundTransform; 28 sndTransform.volume = .1; 29 sndChannel.soundTransform = sndTransform; 30 evt.target.removeEventListener(Event.COMPLETE, onSoundLoaded); 31 } 32 33 var particles:Particles = new Particles(); 34 addChild(particles); 35 36 var controls:MovieClip = new MovieClip(); 37 controls.y = 360; 38 addChild(controls); 39 40 var siteLink:String = "http://www.learningactionscript3.com/"; 41 var linkBtn:SimpleButton = new BtnLink(); 42 linkBtn.x = 20; 43 controls.addChild(linkBtn); 44 45 linkBtn.addEventListener(MouseEvent.CLICK, onShowLink, false, 0, ¬ true); 46 function onShowLink(evt:MouseEvent):void { 47 navigateToURL(new URLRequest(siteLink), "_blank"); 48 } 49 50 var changePBtn:Button = new Button(); 51 changePBtn.x = 120; 52 changePBtn.label = "Change"; 53 controls.addChild(changePBtn); 54 55 changePBtn.addEventListener(MouseEvent.CLICK, onChangeParticle,¬ false, 0, true); 56 function onChangeParticle(evt:MouseEvent):void { 57 var p:MovieClip = MovieClip(particles.getChildByName(¬ "particle" + (particles.count - 1))); 58 if (p != null) { 59 p.graphics.clear(); 60 p.graphics.beginFill(0xFF0000); 61 p.graphics.drawRect(-20, -20, 40, 40); 62 p.graphics.endFill(); 63 particles.particleSound(p); 64 } 65 }
The following is an explanation of ActionScript 3.0-specific issues that appear in the main timeline frame script.
Notice in Line 1 that the class path has changed from
mx to
FlashVars are no longer
stored as global variables in the root timeline. Instead, they're
stored in the
parameters object
of the
LoaderInfo instance of
the root, as seen in line 4.
Although you can use appropriate string values, it is a best
practice to use relevant constants for many property values in
ActionScript 3.0. In this case, the format's
align property is populated with the
RIGHT constant of the
TextFormatAlign class, used in line
The application of the
TextFormat instance in line 14 has been
changed from
All display objects are created with a simple consistent
new <class
structure. The ActionScript 2.0 TextField creation method is
replaced with the ActionScript 3.0 instantiation (line 9) and
followed by the assignment of property values (lines 10 through
The ActionScript 3.0 display list automatically handles
depth management so you don't have to manually assign levels or
worry about methods like
getNextHighestDepth() or the
DepthManager. As such, you don't see any
level assignments in any of the object instantiation
However, you can still control depths. For example, you
still have a
method for moving the background image below the text field, as
seen in line 14 of the ActionScript 2.0 main timeline frame script
code. However, you have an easier way to handle this when objects
are added to the display list. In ActionScript 2.0, existing
objects are replaced when a new object is added to the same level.
ActionScript 3.0, however, moves all objects above the target
level one level higher, and then inserts the addition where
Therefore, you can easily place the background image behind
the text field when the image is added, as seen in line 18. The
addChildAt() method is used,
specifying level 0. The background image appears in level 0, and
the text field is moved to level 1.
While you can in some cases omit typing a variable, all
variables must be declared with the
var identifier.
Rather than creating an empty movie clip, a
Loader display object is used lines (17
through 19). Instead of using the image path as a string for the
load() method, ActionScript 3.0
requires a consistent use of the
URLRequest class for processing
the URL prior to use.
Although the creation of the
Sound instance is the same (line 21),
sound management diverges significantly from that point on.
Loading is similar, with a change of method name to the more
load() and the
URLRequest instance
instead of a string. The event handling is significantly different
in ActionScript 3.0 (and is explained in a moment), but the idea
behind it, as it pertains to sound, is the same: wait until the
sound is loaded, and then proceed.
However, three new classes play a big part of sound
management. First, each sound is typically played into its own
discrete sound channel, an instance of the
SoundChannel class (lines 25 and 26).
This step is a requirement if you wish to perform sound
transformations. Where the
volume and
pan properties existed in the
Sound class in ActionScript 2.0, they're
now accessible through the
soundTransform property of the
SoundChannel class.
To effect such a change, an instance of the second new
SoundTransform is
derived from the
soundTransform property (line 27), the desired property
is changed (
volume, line 28)
and the new instance is reapplied to the
SoundChannel soundTransform property
once again (line 29).
The third new class, not used in this example, is the
SoundMixer class. This class
lets you manipulate all the sounds at once. The isolation of
sounds into their own discrete channels lets you control each
sound separately and with greater precision.
Event handling is very different in ActionScript 3.0. For detailed information, see Chapter 14, How Do I Work with Events?. From a migration standpoint, event handlers are no longer attached to the target of the event. Instead, event listeners are created, specifying an event to listen for, and a function to trigger upon an occurrence of that event (lines 23 through 31).
A mandatory parameter is used to receive information from
the event that can be used inside the function. For example, the
target of the event in the mentioned listener is the
snd object. That is referenced by
evt.target in lines 26 and
The events are specified as constants, as discussed
previously with the
align property, and optional parameters allow more granular
control over when the event is processed (capture or
target/bubbling phases and priority) as well as whether weak
references are used for a little backup help in the memory
management department.
Finally, you should remove the listener when you no longer need it, for optimal memory management (line 30). You also find event listeners in lines 45 through 48, and 55 through 65.
Void is now lower case (lines 24, 46, 56).
Percent value scales are now from 0 to 1 (instead of 0 to 100).
ActionScript 3.0 lets you much more easily use custom
classes as display objects. You don't need to rely on a
Library-based symbol, or more convoluted methods, to instantiate
the class. Instead, provided the class extends
Sprite, Shape, or another applicable
display object, you just need to instantiate it the way you would
any other display object:
<classname>(); (line 33). You must then add the
instance to the display list for the user to see it.
Another movie clip is dynamically generated in line 36. Note
the simplicity of creating an empty movie clip container (to hold
buttons). Rather than using one of many methods, such as
createEmptyMovieClip(), the consistent
new MovieClip() approach is all
you need, coupled with the
addChild() method on line 38.
Line 37 is one example of the fact that ActionScript 3.0 properties are not preceded by an underscore.
The same custom button used in the ActionScript 2.0 version
can be instantiated here as a proper button (
SimpleButton, line 41) rather than using
MovieClip method and typing
the instance as a
MovieClip or
Object. It's then positioned,
and added to the display list (lines 42 and 43, respectively).
In this case, however, the
SimpleButton class is a sealed class, so
you can't add the site URL used by the button as a property. In
this case, it's stored in a standard variable.
You could have brought these two examples into a more
parallel structure by using movie clips for buttons in both cases,
MovieClip is a dynamic
class and would allow the addition of a property. However, the
purpose of this chapter is not to change the way you want to work,
but to understand how best to migrate a legacy project to the new
syntax of ActionScript 3.0.
Taking advantage of the new
SimpleButton class is desirable, and
even lets you create a button entirely from code (no Library
assets) if preferred.
To see an exact parallel, you can add an example property to the text field instance in both versions of the project. In the ActionScript 2.0 version, adding
txtFld.inUse =
after line 10 works. However, adding the same line in the
ActionScript 3.0 version after line 15 generates an error because
TextField class is sealed
in ActionScript 3.0.
Line 47 shows the new syntax for accessing a URL, using the
navigateToURL() method and
URLRequest instance.
Adding a component to your project on the fly is really no
different from adding a movie clip or other display object. Just
use the
Button class as you
would another display object class, as seen in line 50. (As with a
custom asset, a Button component must be in your
You can't access a dynamically created object directly by
instance name. That is, setting the name property in ActionScript
3.0 doesn't make it possible to reference the object using the dot
syntax object model. Instead, you must use the
getChildByName() method, as seen in line
Although the
beginFill(), and
endFill() methods are the same in
ActionScript 3.0, they're methods of the
Graphics class, accessed through the
graphics property instance of each
relevant display object. Further, you don't need a custom function
to draw a rectangle, as the new
drawRect() method does that for
Particles class
functionality is the same in ActionScript 3.0. It creates each particle,
establishes its behavior, and ultimately removes it from the
1 package { 2 3 import flash.display.*; 4 import flash.events.*; 5 import flash.media.*; 6 import flash.net.*; 7 8 public class Particles extends Sprite { 9 10 private var _count:int; 11 private var _soundNum:int = 0; 12 private var _tempSound:Sound; 13 14 public function Particles() { 15 addEventListener(Event.ADDED_TO_STAGE, onAdded, ¬ false, 0, true); 16 addEventListener(Event.ENTER_FRAME, onLoop, false, ¬ 0, true); 17 _tempSound = new Sound(new URLRequest( ¬ "../audio/note0.mp3")); 18 _tempSound.addEventListener(Event.COMPLETE, ¬ onSoundPreloaded, false, 0, true); 19 } 20 21 private function onAdded(evt:Event):void { 22 x = this.stage.stageWidth / 2; 23 y = this.stage.stageHeight / 2; 24 removeEventListener(Event.ADDED_TO_STAGE, onAdded); 25 } 26 27 private function onSoundPreloaded(evt:Event=null):void { 28 _tempSound.removeEventListener(Event.COMPLETE, ¬ onSoundPreloaded); 29 if (_soundNum < 7) { 30 _soundNum++; 31 _tempSound = new Sound(new URLRequest(¬ "../audio/note" + _soundNum + ".mp3")); 32 _tempSound.addEventListener(Event.COMPLETE, ¬ onSoundPreloaded, false, 0, true); 33 } 34 } 35 36 private function onLoop(evt:Event):void { 37 makeParticle(0x0066CC, Math.random() * 10 + 10); 38 } 39 40 private function makeParticle(col:uint=0x003366, ¬ size:Number=20):void { 41 if (Math.random() * 10 <= 2) { 42 var p:MovieClip = new MovieClip(); 43 44 if (isNaN(_count)) { _count = 0; } 45 p.name = "particle" + _count; 46 _count++; 47 48 p.graphics.beginFill(col); 49 p.graphics.drawRect(-size/2, -size/2, size, size); 50 p.graphics.endFill(); 51 52 p.xVel = Math.random() * 10 - 5; 53 p.yVel = Math.random() * 2 - 1; 54 55 p.addEventListener(Event.ENTER_FRAME, ¬ onRunParticle, false, 0, true); 56 addChild(p); 57 58 MovieClip(parent).txtFld.appendText(p.name + "\n"); 59 MovieClip(parent).txtFld.scrollV = ¬ MovieClip(parent).txtFld.maxScrollV; 60 } 61 } 62 63 public function particleSound(p:MovieClip):void { 64 if (!p.snd && _soundNum > 0) { 65 var num:int = int(Math.random()*_soundNum); 66 p.snd = new Sound(new URLRequest(¬ "../audio/note" + num + ".mp3")); 67 p.channel = new SoundChannel(); 68 p.channel = p.snd.play(); 69 } 70 } 71 72 private function onRunParticle(evt:Event):void { 73 evt.target.x += evt.target.xVel; 74 evt.target.y += evt.target.yVel; 75 evt.target.rotation += 5; 76 evt.target.alpha -= .02; 77 78 if (evt.target.snd) { 79 var trans = evt.target.channel.soundTransform; 80 trans.volume = evt.target.alpha / 10; 81 trans.pan = (evt.target.x / this.x) * 2; 82 evt.target.channel.soundTransform = trans; 83 } 84 85 if (evt.target.alpha <= 0) { 86 if (evt.target.snd) { 87 evt.target.channel.stop(); 88 } 89 evt.target.removeEventListener(Event.ENTER_FRAME, ¬ onRunParticle); 90 removeChild(MovieClip(evt.target)); 91 } 92 } 93 94 public function get count():int { 95 return _count; 96 } 97 } 98 }
As with the ActionScript 2.0 section, basic syntax issues discussed in the main timeline won't be mentioned again.
Line 1 shows that all ActionScript 3.0 classes must be
enclosed in a
package statement. This line
would also be where you would include a path to the class, if
desired. Lines 8 and 14 remain consistent with ActionScript
Lines 3 through 6 import all the classes to make them accessible to the compiler. Unlike ActionScript 2.0, even classes in Flash Player must be imported.
Lines 10 through 12 are consistent with ActionScript 2.0.
Lines 10 and 11 use the
int data type because you don't need
float values. You can also see this characteristic in lines 40 and
65. 40 is a good example, as the
uint data type is used, because a color
value can't be negative.
Much has been made of the performance of the
uint data type and, to a lesser degree,
int data type, so you can
decide whether or not to use them. This is just an example.
Unlike ActionScript 2.0, the stage isn't a global object.
Instead, you must access the stage through a display object. The
Particles class both extends
MovieClip, and is added to the
display list in the main timeline frame script, so you can access
the stage without passing a reference to it through the
However, you can access the stage only after the display
object has been added to the display list. Therefore, this class
can't access the stage within its constructor, as the class hasn't
yet been fully initialized. Instead, a new event listener is added
to listen for the Event.ADDED_TO_STAGE event (line 15). Once this
event fires, the display object is part of the display list, and
the stage reference doesn't return
Lines 21 through 25 contain the function used for this
purpose and, because the listener is no longer necessary, it's
removed upon execution of this function. (The
this keyword is not strictly needed
because the relevant scope is the class itself, but it's been
added to emphasize that you're accessing the stage through a
display object.)
The use of the enter frame event for the class is the same;
however, note that, because event handlers no longer exist, you
can't just name a function
onEnterFrame() and expect it to work.
You must convert that structure to an event listener design, seen
in lines 16 and 36 through 38.
You no longer need the
Delegate class, as ActionScript 3.0
supports method closures.
The sound preloading routine hasn't changed, and doesn't
include any ActionScript 3.0 syntax issues that haven't already
been discussed, with one small exception. If you pass a valid
URLRequest instance to the
Sound class constructor, as in line 31,
load() method is
automatically called.
It's also a good idea to look this method over with regard
to removing listeners. It's important to remove the load complete
listener from
_tempSound after
each sound has been loaded (or, if you prefer, after the last
sound has loaded) to prevent the listener from remaining on the
last sound.
ActionScript 3.0 has nothing unique in the
makeParticle() method that hasn't been,
or won't be, discussed elsewhere. However, be sure to read about
changes to default values, accessing objects in the parent, and
using the Drawing API (now commonly referred to as the
Graphics class).
ActionScript 3.0 allows the assignment of default values to method arguments, as seen in line 40. This action makes the associated arguments optional, but all optional arguments must appear at the end of the method signature.
Further, default values for data types have changed in
ActionScript 3.0. For example, line 44 can no longer test for
undefined, as the default value
for number data types is
(not a number). As such, you must use the
isNan() method to validate its
As is true with many intentionally injected migration issues in this exercise, this could have been handled a different way. This property could have been initialized in line 10, for example, but was not so this issue could be discussed.
In Lines 58 and 59, the particle must cast the type of its
parent before it can access the parent's methods or properties.
Without this step, the compiler knows only that the parent's a
display object container, but not what kind. The compiler,
therefore, doesn't recognize the
txtFld property of the parent.
When cast to a
however, the compiler knows that
MovieClip is a dynamic class and can,
therefore, have custom properties. It then looks for
txtFld in the parent. and finds the text
field you created.
When adding text to the text field (line 58), the
appendText() method was used, as it's
much faster than the compound operator
+=. Furthermore, the property
scrollV must be updated to the value of
maxScrollV (line 59).
Nothing about the
particleSound() method that is unique to
ActionScript 3.0 hasn't already been discussed. Line 64 checks to
make sure the particle's
instance hasn't already been created, and that
_soundNum has been incremented to be
sure the sounds have preloaded. Line 65 creates a random number
within the count of available sounds, line 66 creates an instance
of the
Sound class and loads
the sound, and lines 67 and 68 create a
SoundChannel instance and play the
The behavior of the ActionScript 3.0 particles isn't unique,
but a few very important concepts should be discussed. To begin,
the first number of the product used for the sound transformation
pan value is calculated using
the particle's
x divided by the
Particles class'
x (line 81). This step's in contrast to
the ActionScript 2.0 calculation, which divides the first number
by the class's parent's
x value (line 73 of the ActionScript 2.0
class code). ActionScript 2.0 requires the Library movie clip to
instantiate the class this way, so the movie clip must be
referenced in the calculation. ActionScript 3.0 lets you add this
class to the display list directly, so only the class needs to be
Next, you must stop the sound, and remove the event listener, before removing the particle. Otherwise, the particle and its attendant objects, (such as listeners) won't be collected by the garbage collector and purged from memory.
The compiler must be told that the object is a
MovieClip to prevent an error from
occurring, because the compiler sees only the target of the method
as an
Object that may or may
not be removable. However, this issue has already been addressed
in the "Accessing Objects in the Parent (Type Casting)" section of
this discussion.
Nothing unique about the
count() getter method is unique to
ActionScript 3.0 hasn't already been discussed
This is a small example of one possible migration path used to update a legacy project to ActionScript 3.0. Although awkward coding choices were made to show the largest number of migration issues practical in this size example, the exercise is still relatively close to a real-world scenario.
Having read this chapter, you may want to see if you can migrate this example on your own. Once you try the process a few times, you'll have a pretty good idea of what you need, and you can evaluate the effectiveness of migration on a case-by-case basis. Depending on the extent of the changes, you may wish to use the old project as a kind of template, and then code the new version from scratch.
This excerpt is from The ActionScript 3.0 Quick Reference Guide. If you're ready to give your Flash projects a considerable performance boost, learning ActionScript 3.0 is a must. This Quick Answer Guide is designed specifically to help Flash designers and developers make the leap from ActionScript 2.0 to the new object-oriented ActionScript 3.0 quickly and painlessly. You'll learn key differences between the two language versions, allowing you to more easily leverage ActionScript 3.0 using Flash CS4 and other Adobe technologies like Flex and AIR.
Copyright © 2009 O'Reilly Media, Inc.