Donnerstag, 1. Januar 2009

Talkin' Trash


Hi class,
Speaking of Disasters, Toxic Hazards and Pollution, I just finished writing this song about pollution called "Talkin' Trash" for the upcoming documentary film "Recycle Circus", part of the trilogy of documentaries about our Circus Guy Musical Goodwill Ambassador Program. Check out http://greenheadmedia.org/pages/documentary.html if you want to see the first documentary, Solar Circus, and parts of the second documentary, Water Circus.
In a week or so I will hopefully finish a demo recording (a scratch version) for you to hear. Meanwhile, here are the chords and lyrics (any musicians among you?).


Talkin’ Trash c 2007 T.H. Culhane Cairo, Egypt
(Bb6/F arpeggio to F#7/E arpeggio twice)

(Bb6/F) Look beyond the garbage in the (Gm) streets to find the (Gm7/F) garbage in your (F#7/E) mind…
Then (Bb6/F) rise above your prejudice of (Em7b5) class to see there’s treasures there to (Ebmaj7) find… (Ebmaj7/C) in (Gm9 pull off )garbage… (Ebmaj7b5 pull off) in garbage… (Gm9 pull off to Ebmaj7b5 pull off)
(Bb) Everyone is told (Everyone is told) (Bb/A) that one man’s garbage is another’s gold
But (Gm) why’re we never told (why’re we never told) (Gm/F) that one man’s gold creates another’s (Cm) garbage? (Ebmaj7) (F#7/E)
(Bb) Lies are often told (Lies are always told) (Bb/A) If they obscure the facts they think our hand will fold (Gm) We’ve got to lay it on the table’n BOLD (Gm/F) that “Pollution is always someone else’s (Cm) profit”… (Ebmaj7b5 pull off) (They’re makin’ lots of money off it…)

Dm / Cm / Dm / Cm / (with cello)
(Dm) (spoken): “It’s a fundamental idea in economics that surplus value creates profit. If that (C#m) surplus can no (Cm) longer be extracted from labor then it must come from the externalization of production residuals – what we call (C#m) “garbage”.

(Dm) This means to both the firm and the family that ‘negative externalities’ must never be paid for, (Cm) must never be accounted for, must (Cm) always be thrown into, dumped into, someone else’s back yard…” (Gm pull off)


(sung): (Dm) When we gonna learn (when we gonna learn)
That one man’s gold creates a-(C#m) nother’s (Cm) garbage?
It’s an adage we recycle, we reverse the lesson that we all earn our
(Dm) Livings from a dustbin from a trash heap of worn ideas (C#m) gleaned from (Cm) garbage

(Cm!)that one’s man’s trash can be another’s gold obscures the (Cm!) darker story that’s never told

(Ebm!) For all that glitters, new or old, is (Ebm!) in the mind, spun into gold by
(B!) those who learned “sell high, buy low”,
the dogma (B/A) behind the status quo is (Bb) garbage… (F#7/E) just garbage… (Bb) (F#7/E)

And it’s (Gm) more than mere frustration

without (F) point-source (Cm) separation

we (Gm) enforce immiseration

having (F) no appreciation

(Cm) that there’s a (Gm) downstream side relation to it (F) all… (Cm)

There (Gm) persists a sad delusion

that the (F) problem of (Cm) pollution can be (Gm) solved by mere dilution –

but that’s (F) not the right (Cm) solution

and there’s (Gm) still too much confusion about it (F) all…

(Cm) We’re now (Gm) plagued by concentrations,

(F) caused by bio-accumulation (Cm)

for many (Gm) toxins simply don’t disperse at (F) all (Cm)

(Ebm) There’s two spheres in which we should operate
One well established, one inchoate
(B) An ecosphere and a technosphere
put organics there, inorganics here (B/A)
this industrial ecology’s the (Bb) way… (F#7/E) to…

(Bb6/F) Look beyond the garbage in the (Gm) streets to find the garbage in your (F#7/E) mind

Then (Bb6/F) rise above the blindness of your (Em7b5) past to see the profits men have (Ebmaj7) mined…

(Ebmaj7/C) from (Gm pull off) garbage…

from (Ebmaj7b5 pull off) garbage…

It’s all (Gm pull off) garbage…

(Ebmaj7b5 pull off) garbage…

We’re talkin’ TRASH…

Bb5 A5 Gm6/9 !!! Bb5 A5 Gm6/9 !!!

Maey Oh Maey! (Water, oh Water!)

Maey Oh Maey! (Water, oh Water!)
copyright 2005 T.H. Culhane, Melodic-Mnemonics






This is the song we performed in Kuwait (2005) and Morrocco (2006) on our Circus Guy Goodwill Musical Ambassador tours. This video (powerpoint) was projected on a screen behind the band as we played the song. We also performed this in a Palestinian refugee camp during the conflict between Israel and Hezbollah in the summer of 2006. The recording was done in Dobbs Ferry, New York in January 2007.

This is one of the two songs (along with "Springtime by Design" that will be featured in "Water Circus", produced by James Dean Conklin and Elissa Zazzerra at Greenheadmedia.org

In the goodwill concerts we did during Education Week in Kuwait with the U.S. State Department, before our song and presentation, we thanked the Kuwaiti people and government saying the following:

Spoken:.
"Through Hurricane Katrina, we have seen the power of water for good and ill, in its various forms as rain, storm, flood, contaminated sink of dangerous pollution and, of course, life sustaining blessing for drinking, irrigating and cleansing. From this tragedy we have learned much about the importance of respecting and taking care of water, and we have learned much from the international goodwill response to this terrible event.
“Circus Guy would like to personally thank the government and people of Kuwait for their generous financial and humanitarian support, helping the people of America recover from the environmental and social tragedies that resulted from Hurricane Katrina.
It is in that spirit that we offer this song about that most precious of the world’s resources… something every Arab knows very well!"

Then we began the song:


(tempo 118 bpm, 8 beat)


Verse I
Fmaj7 add G arp, Fdim add G arp, Em7, Am7, Dm, Dm/G G7
Spoken:
Allah made *{of water every living thing}* (Al-Anbiyaa’ 21:30),
...و جَعَلنا من الماءِ كُلَّ شَيءٍ حيٍّ أفلا يُؤمِنونَ (سورة الأنبياءِ ٢١:٣٠ )
The total volume of water on Earth is about 1.4 billion cubic kilometers, but only 41 million of this is fresh water that we can drink and use. We must protect this precious heritage. We must recycle it, we must purify it and make it good to drink again, as Allah intended. We are the stewards of the earth.. and the water…


(Am) There´s lots of talk about (F#m7b5) disasters that are coming down the (F) pike…
(D7) We´re told we´ll soon run out of water and we´ll one day have to (Bb) fight (E7) (riff e g# b e, ´live and let die!´)
(F) But water´s not like oil, it never disappears…
(Dm) It´s so abundant there´s no need for all these fears
(Bb13) Water, water everywhere, but not a drop to drink?
(E7) Purifying water, friends, is easier than you think…
(F) Making new fresh water is as simple as can be
(D7)Through Distillation and osmosis and some fun technology, You’ll see… (E7) … Because we´re…

(Chorus)

(Am) Living on a water planet
(F) Blue and green on top of granite… (Am) Maey! (bass and horn riff a e g a c a)
(Am) You may call this planet ´Earth´ but
(F) Water is our place of birth…
(D7) A hypersea of living liquid (G7) LIFE!… We´re alive…
´Ashan Maey! (Am) (bass and horn riff a e g a c a) (´Ashan Maey means ´because of water´)

Spoken:
"About 80% of the diseases that plague humanity are water-borne – cholera, typhoid
Amoebic dysentery, diarrhea, and other pathogenic diseases, not to mention
arsenic, lead, mercury and other forms of heavy metal poisoning. These are all completely avoidable. All we have to do is stop dumping our biological and chemical wastes into our water supply. Drinking quality fresh water should NEVER be used to carry our filth. Polluting our water supply is an inexcusable and criminally dangerous practice. Nobody should ever have to get sick or die because of dirty water"

Verse II
(Am) Khilafah means earth stewardship, to (F#m7b5) keep our wastes and filth away from (F) Maey
(D7) Amana is the trust Allah bestowed on all of us to learn and (Bb) try… (iqra!) (E7)Try to do right!)
(F) We must learn from Allah´s plan…, the balance, `Al-Mizan`
(Dm) Learn the hydrologic cycle as water goes through plants to man
(Bb13)Wastes don´t belong in water, not in the toilet nor the sink
(E7) Filth must be composted, water must be fit to drink
(F) Our rivers can´t be sewers, not for home or industry
(D7) We can keep our water pure and clean for all eternity, you’ll see (E7) … because we`re…



(Chorus)
(Am) Living on a water planet
(F) Blue and green on top of granite… (Am) Maey? (bass and horn riff a e g a c a)
(Am) You may call this planet ´Earth´ but
(F) Water is our place of birth…
(D7) A hypersea of living liquid (G7) LIFE!… We´re alive…
´Ashan Maey! (Am) (bass and horn riff a e g a c a) (´Ashan Maey means ´because of water´)

Am-F Am Am/B C11, C9

Bridge:

There are (F) Living Machines that can (F#m7b5) make water clean again… (C)
Plants and (F) algae, it seems, like to (F#m7b5) play on our team…
(G) Cleaning our wastes, puri- (E ) fying our streams…
(F) Wind and sunlight can power desalinization, making
(F#m7b5) salt water fresh water through distillation

(C ) Maey…. oh… (Am) Maey….
(F) Oh why can´t we (F#m7b5) see it´s the (C ) reason we thrive (Am)
(Am7) Allah gave us Maey! (Fmaj7 add G arp) But we have to be wise… Fdim add G arp)
(Em7 arp) We must practice Amana, be the viceroys of life! (Am 7 arp) Allah gave us (Dm7 arp) Maey, oh maey oh maey! (Dm/G) (G7)

(Chorus)
(C) Living on a water planet
(Am) Blue and green on top of granite… (Fmaj7 arp) Maey! (bass and horn riff a e g a c a)
(C) You may call this planet ´Earth´ but
(Am) Water is our place of birth…
(F) A hypersea of living liquid (G7) LIFE!… We´re alive…
´Ashan Maey! (C arp) (Am7 arp) (C arp) (Am7 arp) (Fmaj7 arp)

When we performed the song, singing to hundreds of schoolkids (including the children of the Sabah oil sheikh family) in front of the IMAX theatre screen in the Kuwait Science Center, with our video behind us on the 70 foot screen, we made the mistake of having the slide with the Qur'anic quote showing while the musical intro began. This deeply offended our fundamentalist hosts, who told us that one must never associate the Qur'an (Koran) with music or entertainment of any kind! We thought we were honoring Islam! In subsequent concerts we remedied the problem by simply showing the slide before the music began and after it stopped. As long as there is no music playing while referencing the Koran, we were told, things are okay.



Quranic environmental science quotes from various Arabic web sites:

*{Then set your face upright for religion in the right state-- the nature made by Allah in which He has made men; there is no altering of Allah's creation; that is the right religion, but most people do not know.}* (Ar-Rum 30:30)
In the Quran, men and women are viewed as God’s vicegerents on Earth. (2:30). God created nature in a balance (“al-mizan”) and mankind’s responsibility is to maintain this fragile equilibrium through wise governance and sound personal conduct."


"The Quran also describes the believing men and women as those who “walk on the Earth in humility.” (25:63). Scholars have interpreted this verse, and others like it, to mean that Muslims are to protect nature’s many bounties given to them by the Almighty. Preservation is therefore more than a good policy recommendation - it is a commandment from God.
Allah has blessed the earth on which we live with abundant natural resources, and He has given the human race intelligence and power to use these resources for its benefit. At the same time, Allah has bestowed upon human beings the honor and responsibility of khilafah (stewardship) of these natural resources. The concept that it is our sacred duty to respect, preserve, and sustain the animals, plants, and inorganic resources of the Earth was revealed to the Muslims 1400 years before the term "human habitat (environmentalism)" was coined in the West. Allah has revealed, "Behold, thy Lord said to the angels, 'I will create a vicegerent on earth.' They said: 'Wilt Thou place therein one who will create mischief therein and shed blood?' ..." (Surah Baqara, ayah 30), for, unfortunately, man has been learning the hard way the lesson that wanton exploitation of natural resources leads to irreversible destruction."

Mittwoch, 31. Dezember 2008

The Future is Here, The Future is Now


"The Future is Here, The Future is Now" is a song that T.H. Culhane and Frank DiMassa created for their renewable energy educational campaigns. The song was taken on the road by the Circus Guy Musical Goodwill Ambassador program (performed by T.H., Mike and Andrew Culhane, Anais Mitchell, Ted Stern, Greg Ross, James Dean Conklin and Frank Marino) and performed in a series of solar and wind powered concerts at the Wadi Environmental Science Center in Egypt and throughout the country with the U.S. State Department Cultural Affairs Program. It was then performed in Kuwait during a series of tours that culminated with its performance for the Sabah family children (kids of the oil sheikhs) and their classmates in the Imax Theatre at the Kuwati Science Center. It was recently performed on KPFK radio's "Healthy Me, Healthy Planet" hosted by Sherry Beale.







The Future is Here
Words and Music copyright 2004 T.H. Culhane, Melodic-Mnemonics


(Starts with conga drums with implied D7 as fifth of the key, bass note descends E D, B A, G into a Gmaj7)
Spoken:
(Gmaj7) “Every day we live our lives oblivious to the  ( Gmaj6) deleterious effects of our actions,
as we (Em9) unwittingly and indiscriminately burn gas and oil (Em7) in our internal combustion engines, turbines and boilers.
(Am6) But the bell is tolling for these irresponsibly ( Am7) inefficient and unhealthy technologies,
and it is time we heeded the call of our mother earth…
(D7) ‘The stone age did not end because we ran out of stones’”… (D7b9)

(C7 with descending bass line)
Hey!
(G7 with descending bass line)
Check it out!
(C7 with ascending bass line)
I want to tell you about it!
(G7 with 1 5 8 arpeggio).


Because the (C7) future is (G7) here
Because the (C7) future is (G7) NOW
Because a (C7) few things are (G7) clear
No need to (Am) fear… (A7)
Just watch the (Bb) bad times disappear (D7)

Because the (C7) future is (G7)  wind
Because the (C7) future’s the (G7) sun
Because the (C7) future is (G7) green
The future’s (A7) clean
And there’s (Bb) enough for everyone… (D7)

Since (G7) Time Immemorial…
The Earth’s been making coal an oil
(C7) Sunshine stored in wood and fossil fuels
(G7) We’ve been dipping in the past, for energy that will not last.
(C7) An alien would think that we are fools
(G7) Cause all along we’ve had the choice
To use the sun sustainably
(C7) And make a brighter future for us all
(G7) We now have the technology
To free us from dependency
(C7) And wean us from the grip of foreign oil


Because the (C7) future is (G7) here
Because the (C7) future is (G7) NOW
Because a (C7) few things are (G7)  clear
No need to (A7) fear…
Just watch the (Bb) bad times disappear (D7)


(G7) Carbon was the enemy
an element in you and me
(C7) Sequestered by the flowers and the trees
But (G7) burned, it makes a mess of things
And a host of new carcinogens,
and (C7) all the global warming that we see
(G7) The future should be carbon-free
With new clean forms of energy
Like (C7) Hydrogen and Boro-Hydride Salts
(G7) Micro-Hydro, Wind and Sea
Geothermal and PV
You’ll (C7) see we don’t need carbon fuels at all.


(Eb7)Take a joy ride on the Hydrogen (Bbm) Highway
(Eb7) Check out all the wind farms by the (Bbm) road
A (Eb7) million solar roofs around the (Bbm) country
Are (F#7) shaving costs and handling peak (F7) loads…

(F#) We’ve got the power…
(Bbm) Tremendous power…
(F#) Plenty of power…
(Bbm) Clean and Green Power
There’ll (Dmaj7) never be a crisis here again… (D7)


(C7 with descending bass line)
Hey!
(G7 with descending bass line)
Check it out!
(C7 with ascending bass line)
                 I  like a clean future
                     (G7)
             That’ what I’m talkin’ about!

We DON’T (G7) NEED atomic plants, sir
Fuel Cells are the answer
(C7) They produce only pure water with their kilojoules
(G7) Screw the radiation and runaway inflation
(C7) Everyone can make their own clean fuel
By (G7) electrolyzing water, using sunlight and wind power
(C7) You can make your hydrogen in your own home
And (G7)  how to store the hydrogen? This has been the problem
But in (C7) fact we’ve had the answer all along
(G7) A liquid soap solution
That can clean up our pollution
(C7) It’s detergent, yes,
It’s BORAX, and it’s clean
(G7) It comes from desert sands
Produces H2 on demand
It can (C7) create the Hydrogen Economy (D7)

                      (D7b9! D7b9!  D7b9!)

Because the (C7)  future is (G7) here
Because the (C7) future’s the (G7) sun
Because the (C7) future is (G7) green
The future’s (A7) clean…
And there’s (Bb) enough for everyone (D7)
Shine on! (G)




Lyrics only:

The Future is Here
Words and Music copyright 2004 T.H. Culhane, Melodic-Mnemonics

Spoken:
“Every day we live our lives oblivious to the deleterious effects of our actions,
as we unwittingly and indiscriminately burn gas and oil in our internal combustion engines, turbines and boilers.
But the bell is tolling for these irresponsibly inefficient and unhealthy technologies,
and it is time we heeded the call of our mother earth…
‘The stone age did not end because we ran out of stones’”…


Because the future is here
Because the future is NOW
Because a few things are clear
No need to fear…
Just watch the bad times disappear

Because the future is wind
Because the future’s the sun
Because the future is green
The future’s clean
And there’s enough for everyone…

Since Time Immemorial…
The Earth’s been making coal an oil
Sunshine stored in wood and fossil fuels
We’ve been dipping in the past, for energy that will not last.
An alien would think that we are fools
Cause all along we’ve had the choice
To use the sun sustainably
And make a brighter future for us all
We now have the technology
To free us from dependency
And wean us from the grip of foreign oil


Because the future is here
Because the future is NOW
Because a few things are clear
No need to fear…
Just watch the bad times disappear


Carbon was the enemy an element in you and me
Sequestered by the flowers and the trees
But burned, it makes a mess of things
And a host of new carcinogens,
and all the global warming that we see
The future should be carbon-free
With new clean forms of energy
Like Hydrogen and Boro-Hydride Salts
Micro-Hydro, Wind and Sea
Geothermal and PV
You’ll see we don’t need carbon fuels at all.


Take a joy ride on the Hydrogen Highway
Check out all the wind farms by the road
A million solar roofs around the country
Are shaving costs and handling peak loads…

We’ve got the power…
Tremendous power…
Plenty of power…
Clean and Green Power
There’ll never be a crisis here again…


We DON’T NEED atomic plants, sir
Fuel Cells are the answer
They produce only pure water with their kilojoules
Screw the radiation and runaway inflation
Everyone can make their own clean fuel
By electrolyzing water, using sunlight and wind power
You can make your hydrogen in your own home
And how to store the hydrogen? This has been the problem
But in fact we’ve had the answer all along
A liquid soap solution
That can clean up our pollution
It’s detergent, yes,
It’s BORAX, and it’s clean
It comes from desert sands
Produces H2 on demand
It can create the Hydrogen Economy

Because the future is here
Because the future’s the sun
Because the future is green
The future’s clean…
And there’s enough for everyone
Shine on!

Dienstag, 18. November 2008

"Our Father", The Lord's Prayer

 I used to attend the Santa Monica Church in Los Angeles and heard a version of Our Lord's Prayer that had this basic melody and chords at the beginning. It enchanted me.   I can't find a recording of it anywhere. So I've sketched out here what I remember, with some of my own embellishments  up until "And forgive us our trespasses" at which point I'm freestyling with my own chords and interpretation. But I think it makes a nice melodic-mnemonic for learning the Our Father.  (My apologies to the original composers of the melody and chords.)

                (G)                                             (Em)                
2.1 "Our Father,  ( "Our Father)  who art in Heaven" ( who art in Heaven")
           (C)      (Am)       (F)    (D7)
2.2 "Hallowed be thy Name" 

                (G)
2.3 "Thy kingdom come" (Thy kingdom come)

              (Em)                                         (C)           (Cm) (D7)  (G)
2.4 "Thy will be done, (Thy will be done)on earth as it is in heaven"


          (Gmaj7)                                                                      (Em7)
2.5 "Give us this day our daily bread" (Give us this day our daily bread)

                (C)                     (D)                       
2.6 "And forgive us our trespasses,,,,,,,,,,,,,,, 
 (Bm)                                (Em)                     (F)  (D7)
as we forgive those  that trespass.....     against us"........
               (G)                                               (Em)
2.7 "And lead us not (and lead us not)  into temptation"
               (C)                  
 2.8 "But deliver us from evil" (Lord deliver us from evil),,,

    (A7)                                                                                        
2.9 "For thine is the kingdom, (For thine is the kingdom) 
              (C)               (Cm)  
and the power, and the glory,
        (Am)    (D7)   (Eb)     (Cm/F) (G)
for ever and ever. Amen "

Donnerstag, 13. November 2008

Tools for flash

 I wanted to be able to create an animation in Flash MX 2004 where the sun rises and sets over a graph showing TOU (Time of Use).  To guide the animation I wanted to draw an arc as a path.  But the pen tool doesn't seem to work like it does in photshop, so for the life of me I couldn't figure out how to do it.

Fortunately, Ric Ewing over at Adobe created some free Action Script Tools that will do the trick and posted them for all of us free to use here:

http://www.adobe.com/devnet/flash/articles/adv_draw_methods.html

 To create the sun:

From http://www.axialis.com/tutorials/tutorial-misc001.html

Create a Transparent Image using Adobe PhotoShop®

 To be able to duplicate layers and delete empty frames these Macromedia Flash Extensions are key (note you have to download Macromedia Extension Manager 1.6 for Flash MX 2004).
http://www.flashguru.co.uk/category/flash/extensions

Dienstag, 11. November 2008

Building a dynamic tool for input of solar energy economic variables

I've always been inspired by SimCity and The Sims, and wondered how we could use these "games" for more important work -- particularly the design of "Solar Cities". Inspired by the folks at Digital Urban, I tried my hand at building a virtual Egyptian Darb Al Ahmar community in the "Oblivion" Game Engine and then placing solar panels on a couple of the roofs there.

You can see my results below:




and

.

I also tried my hand at using Google Sketchup to create a tutorial for how to adjust our solar hot water system on the Zabaleen school in Muqattam:




Then I discovered Metroquest , the first serious SimCity oriented planning tool.



While it isn't a 3D virtual reality tool, it does a great job of helping planners create future scenarios for evaluation by stakeholders. There are fascinating examples of its use in Yellowknife
and Niagra that you can work through to see how effective the tool is.

The question now is, how do we develop a similar tool for Solar CITIES?

Flash MX may hold part of the answer, so we will start here.

One of the great features of MetroQuest is their use of sliders as input mechanisms. I have long argued (and most recently do so in my Ph.D. thesis) that urban planning should be like mixing a song, working to achieve a harmonious balance of all the elements that make living in cities worthwhile and desirable. My postmodern professor Ed Soja at UCLA, author of "Thirdspace", challenged us to move beyond the binary logic of "either/or" and into the hybridity friendly thirdspace of "both-and". But he cautioned that both-and was not liscence to simply mash everything up.

Coming from a music industry background, I was always comfortable with both-and, finding that the way to achieve beauty was through the proper mix. I have worked on enough mixing boards over the years to appreciate the subtlety and importance of "faders", tweaking the amount of bass and drums and synth pads and vocals until something great came out of the mix.

So when developing a tool to help calculate the costs and infrastructure parameters of effective solar energy set-ups, I knew one of the first tasks I would have to undertake would be figuring out how to create and use faders in Flash.

Fortunately, http://www.maximized.co.uk/flashintro/slider1.html has a great little tutorial with the necessary code in it.

I'll reproduce the code here; for the tutorial click the link above.









  • Open this Button Movie Clip for editing, select the button symbol that is embedded in it, then add the following Actionscript code to the button:







    on (press) {
    startDrag("", false, left, top, right, bottom);
    dragging = true;
    }
    
    on (release, releaseOutside) {
    stopDrag();
    dragging = false;
    }
    














  • Go back to the main Timeline and select the Button Movie Clip. Add the following Actionscript code to the Button Movie Clip:







    onClipEvent (load) {
    top = _y;
    bottom = top + 100;
    left = _x;
    right = _x;
    }
    
    onClipEvent (enterFrame) {
    if (dragging == true) {
    // execute this code
    }
    }
    
    



    They say at the end of the tutorial: " To get the button to do something, look back at the second section of code you added - any code you place in the section marked // execute this code will be executed while the slider is being dragged.
    One thing you should try is to use the slider to control the volume of a music clip. Create a sound object and set it to play continuously. Add a slider to your Flash movie and add code so that it will alter the volume of the sound when it is dragged. Hint: the slider can move up and down in a range of 100 pixels. Sound volume has a range of zero (lowest volume) to 100 (highest volume)."


    So that is a great start!

    But if you are a non-programmer like me, you have no idea how to build the code to add functionality. Fortunately there are some other great tutorials, like this one from http://www.kirupa.com/developer/mx/slider.htm

    The relevant code is:


    this.ratio=0 ;
    dragger.onPress=function(){
    this.startDrag(true,0,0,line._width,0);
    this.onEnterFrame=function(){
    ratio=Math.round(this._x) ;
    }
    }
    dragger.onRelease=dragger.onReleaseOutside=stopDrag;
    or this:


    this.ratio=0 ;
    dragger.onPress=function(){
    this.startDrag(true,0,0,line._width,0);
    this.onEnterFrame=function(){
    ratio=Math.round(this._x*100/line._width) ;
    }
    }
    dragger.onRelease=dragger.onReleaseOutside=stopDrag;

    Now we can use the slider to output ratios from 1 to 100, great for percents!

    GET URL


    One thing we want to be able to do in the program is to make us of the California Solar Initiative Incentive Calculator found at http://www.csi-epbb.com/.  So we need to create a button in flash that calls that website.

    The simple action to attach to the button is


    on(release){getURL("http://www.csi-epbb.com/");
    }


    (You can find functions like "getURL"  by clicking on the + sign under actions at opening "Global Functions" and then "Browser/Network". Make sure you put them after the on(release) command.)



    The only problem is that though the .swf launches a browser when testing on your desktop, when you upload the .swf to a website and click on the button it launches the url in the same window.  This can be a hassle if you are doing on-line training as we are and you want the user to be able to simultaneously view the flash document AND the website the URL reffered to.

    What to do?

    According to ShawnJC:

    "Something you all might be interested. I've been using similar javascript to open windows for some time now, but recently have found out that the new SP2 upgrade for windows XP will install a pop-up blocker by default that blocks a window opened with javascript from a signal from Flash even though it is a user inituated click. I've been trying different things and found that the only way I can get a window to open with Flash that the XP pop-up blocker won't block is with the basic GETURL ("website","_blank") method. So anyway, might wanna test that out if you plan on using Flash and Javascript to open windows..."

    So now my code reads:  on(release){getURL("http://www.csi-epbb.com/", "_blank");
    }  and it works great!

    But wait, there's more!

    The only dissatisfaction I have with using the "_blank" command is that I often already have too many tabs open on my browser (I use Firefox, and I LOVE the new tab feature, but for keeping people involved in a web-based training program it can be distracting to have to keep clicking on different tabs wondering where on the far right of the screen that particular browser window went!) So I want to be able to open the url in a new window (like a popup).

    The code to do that is found here: http://www.actionscript.org/resources/articles/22/1/Pop-Up-window-within-flash/Page1.html

    The basic idea is that you replace on(release){getURL("http://www.csi-epbb.com/", "_blank");
    }
    with a piece of Java Script that looks like this:

     on (release) {
        getURL ("javascript:openNewWindow('http://www.csi-epbb.com/','thewin','height=600,width=800,toolbar=yes,scrollbars=yes');");
    }

    Note that instead of using double quotes in the javascript you use single quote marks.  You can decide if you want the user to have toolbar access (so they can use the window you created to go elsewhere) or scrollbars.  I set them to yes because I like giving people freedom. Vive la liberte!  You can also set the height and width. I like my pop-ups fairly large but not overwhelming.

    All fine and good; it works with the .swf file.  What about opening applications, like Google Earth?

    Opening Applications

    Here I encountered a lot of problems. Seems that somebody created a flash virus once upon a time and so, to protect users from these, the way flash handles functions that call .exe files has been changed.
    But an explanation of how to run files is found here:
    http://www.northcode.com/blog.php/2007/08/07/Conquering-FSCommand-EXEC-Part-1-Proxy

    What I learned to do is to create a folder called "fscommand" in the folder that contains my .fla source file and my .swf.

    Inside that folder I used notepad to create a text document that held this text:

    "C:\Program Files\Google\Google Earth\googleearth.exe" (because that is where Google Earth is on my computer)

    I saved the file and then changed the extension from .txt to .bat.  I called the file "openGoogleEarth.bat".  When I click on it I notice it launches a DOS command window and then launches the program. All fine and good.
    Then, in flash, in my action script for the button I put the following:

    on(release)  {
        fscommand("exec", "openGoogleEarth.bat");
    }

    I notice when I test the movie it does nothing.  But if I PUBLISH the movie as a Windows Projector (an  .EXE file)  as well as an .swf (you find these options under File/Publish Settings) the windows projector will let me launch Google Earth with that button.  The .swf file, however, does nothing.

    I also downloaded a nice little app called proxy.exe that hides the black DOS box.  The trick there was to place "proxy.exe" in the fscommand folder and then rename it "openGoogleEarth.exe" (or whatever name your bat file has.Then IT calls the .bat file which then calls the program.  (You can get better instructions here: http://www.northcode.com/blog.php/2007/08/07/Conquering-FSCommand-EXEC-Part-1-Proxy)


    Thanks to a Swedish forum user named j0h@nB we get the following advice:


    1. A.swf has to be an exe-file, that is, export it as a Flash projector (A.exe)
    2. B.exe has to reside in subfolder fscommand. So, if A.exe is saved in folder C:\somefolder\, then B.exe has to be saved in C:\somefolder\fscommand
    3. You should then be able to use fscommand to execute B.exe as follows...





    Code:
    on(release){
          fscommand("exec","B.exe");
    }

     What about opening files on Macs as well as PCs?

    I turned to this website, http://www.northcode.com/ , for the following advice for how to prepare for cross platform functionality:


    Northcode says the following:


    "If you want to be a little smarter about it you can replace the fscommand exec calls with something like my SmartExec function below.

    SmartExec will figure out what platform it's running on and launch the correct helper to open the target file. The trick is to give your helper applications names that are similar to the file you're trying to open.

    thefile.pdf - name of the file you want to open
    thefile.exe - EXE helper app that opens thefile.pdf on Windows
    thefile_script - AppleScript the opens thefile.pdf on the Mac

    Now to open thefile.pdf you just put SmartExec("thefile"); in your button release events and SmartExec figures out which application to run based on the platform and the helper application does all the work.





    Code:
    function SmartExec(target)
    {
       platform = substring(getVersion(), 1,3);
     
       if (platform == "WIN") 
       {
          // we're running on Windows, target an EXE file
          fscommand("exec", target + ".exe");
       } 
       else 
       {
          // we're running on a MAC, target an AppleScript file
          fscommand("exec", target + "_script");
       }
    }
    There's an article on my blog "Conquering FSCommand EXEC Part 1 : Proxy" that describes how to use a free tool I created and BAT files to open files on a Windows system. If you're using Flash CS3 then you'll also want to have a look at this article FSCommand EXEC is Broken in Flash CS3.

    On the Mac, you would use a compiled AppleScript instead of the BAT file and EXE combination. Like the Windows solution you'll need an AppleScript for each file that you want to open. You can use this script as a tempate.




    Code:
    --set the name of the file to open 
    
    property fileName : "thefile.pdf"
    
    --get the path to the containing folder 
    
    set myPath to (path to me as string)
    set AppleScript's text item delimiters to ":"
    set the parentFolder to ¬
       ((text items 1 thru -2 of myPath) & "") as string
    set AppleScript's text item delimiters to ""
    
    -- find the file and open it 
    
    try
       set targetFile to alias (the parentFolder & fileName)
    on error
       --ie if there's no  file here by this name, it will quit. 
       return quit
    end try
    
    tell application "Finder"
       open file targetFile
    end tell

    I cut and paste Northcode's  SmartExec function into my actions layer and tested it on the PC and it seems to work great. Thanks Northcode!


  • Using Flash MX 2004 to create educational materials

    Frank DiMassa Utility Consulting has hired me again to work out in California creating educational materials to help us realize the dream of the "million solar roofs" initiative and to aid in water and energy conservation efforts.
    Because the materials we are creating are destined for web training, but budgets are tight, we are working with Flash MX 2004 (a.k.a. "Flash 6") and Dreamweaver (though we create our videos in Final Cut Pro).

    As Flash has a steep learning curve (particularly when you are a non-programmer and are working with Action Script) I have decided to post my notes here in this blog post instead of on my physical pad-o-paper notepad (remember pencils and pens and paper?). This way others can benefit from our climb up the learning curve and we can access our notes wherever we happen to be in the world without having to carry a suitcase full of paper!

    Step 1: Converting .mov files to .flv files.

    Since we begin our process by creating our video segments in FC Pro on a Mac, but do our Flash creation on a Windows XP machine, we should start this lesson by exporting from Final Cut to a Quicktime Movie (.mov). Those files are big -- a 3 minute video takes up nearly 600 MB. We pop that onto a USB stick and carry it over to the PC and copy it into our Flash Video folder. Now we have to turn it into a Sorenson compressed .flv file for use in our web presentation.


    A hunt through the user forums revealed this from editorX:
    "hi, it´s possible to create .flv in MX2004.
    import the chosen movie (embedded) in the flash library. select the movie in the library and then right-click on it. select properties and then export in the appearing dialogue."

    Once you do that, you will notice that while the .mov file is now in your library, the .flv file you just created isn't. Don't panic. It should be in the same folder as the .mov file on your hard drive, but it must be now imported into your project library.

    How do you use a video in flash?
    "Basically, it's like a Graphic symbol because the timeline where the video resides needs enough frames to accommodate the entire duration." says UltraShock Tutorials (a great site to go to to learn all about working with video in flash).

    They also say,
    "Remember that because Flash compresses the audio at publish time, it's best to only import .flvs with little or no audio compression and adjust Flash's audio compression settings through the publish settings. (to avoid generation loss due to recompression)."

    If you don't have Flash MX Pro, there are other ways -- free ways -- to convert .mov files to .flv files:

    You can download a free media converter, called Quick Media Converter, here:

    http://quick-media-converter.en.softonic.com/download#pathbar


    Inserting an entire column of frames (shifting all frames in all layers to the right):

    If you want to add frames and extend the timeline for all existing layers accordingly, you merely select the column of frames of all layers at the chosen point in the timeline and F5 them

    How to Delete Frames

    (from http://multimedia.journalism.berkeley.edu/tutorials/webdesign/flash/frames/)

    "Note: Flash has two ways to delete frames - Clear Keyframe and Remove Frames. They're a little confusing. The way to figure out which one to use is to ask yourself why you want to eliminate a frame.
    If you want to eliminate a frame because you want to reduce the length of the movie, then select a frame, and choose Edit > Timeline > Remove Frames, or Shift-F5.
    If you want to remove the status of a keyframe (and therefore, its content), and keep the movie the same length, then select a keyframe or blank keyframe and choose Modify > Timeline > Clear Keyframe (or hold down the mouse and select Clear Keyframe from the menu).
    Clear Keyframe changes a keyframe or a blank keyframe into an in-between keyframe. It removes the content it contained. The new in-between frame displays the content of the previous keyframe."




    Other helpful notes:

    • Motion Tween only works on symbols
    • F8 converts to symbol
    • F6 inserts a new keyframe
    • F5 inserts a frame (and can carry over information from the previous frame)
    • ctl-enter is used to view motion
    • to advance by a frame use the "." key, to go back a frame use the "," key.
    Creation of motion/shape tweens in the basics of flash.

    Before you can specify values in Action Script you need to give each text field an instance name in Property Inspectior

    Componenets -- movie clips that add advanced functionality without you having to know advanced Action Script.

    To labe a Button component: Go to Property Inspector, parameters tab - Label.

    Event handler "Handling Events" in Action Scripts
    Reference Guide Help

    A Button Component has its own timeline. In Timeline hierarchy, component time line is the child of the main timeline. Point to the parent: _parent.

    Set audio to 192 kbps

    Embedding video: a video over 16000 frames will not sync properly and audio quality suffers. But it is more interactive.

    Expand the timeline so all frames are displayed!

    "You'll have to provide your own controller for an embedded movie; flash components (and their skins) won't work".

    Upload of main swf to server -- unlike uploading streaming video, main swf is the only file to worry about.

    Need Flash's video encoder.

    Recommended against using scenes; use framelabels instead.

    on(release) {
    gotoAndStop("scene2", 1);
    }

    is not ideal. Don't use scene names, just the UNIQUE frame labels and add _root to your path.

    Like this:

    on(release) {
    _root.gotoAndPlay("frame-label");
    }

    test the scene using (ctl-alt-enter).

    DON'T USE SCENES!

    "Scenes are an evil kludge created to destroy the minds for otherwise sane flash developers and newbies alike. They are just a way of hiding frame numbers to try and make flash movies more human readable that fails utterly." wrote one flash user on a forum. I agree.

    Helpful action scripts for beginners:

    The following little scripts are your friend for buttons that go back a frame or advance a frame:

    on(release) {
    prevFrame( );
    }

    on(release) {
    nextFrame( );
    }


    My preferred method, if you are going to use the same buttons over and over on every frame, is to attach this action script NOT to the button, but place it in a layer you call "Action Script". If you name the instance of the buttons you can use this function:

    this.forward_btn.onRelease = function( ) {
    nextFrame( );
    }

    and

    this.back_btn.onRelease = function( ) {
    prevFrame( );
    }

    on(release) {
    if(_currentframe = = 1) {
    gotoAndStop(10);
    } else {
    prevFrame ( ) ;
    }

    The conceptual basics:
    1. Graphics objects
    2. Button objects - normal, mouse-over, click, target
    3. Movie Clip
    In the button timeline, target is the area of the button you want mouse events to react to (the center of the button for example, but you could make the target another area of the screen if you wanted).
    Movie Clip is similar to Graphics object on the surface but can be used to create entire animations that can be dragged onto the main movie. Animations created as graphics objects simply loop over and over, but you can control movie objects completely.

    How I finally got the Media Clip to play:

    To get my .flv to play and be interactive, so that I could pause it for the instructional moment and then continue, I first created a mediaclip to embed in one of the frames of my presentation. Then I double clicked on that clip to open its own timeline and created a buttons layer in that timeline and a video layer. I dragged the .flv into the video layer and then created enough frames in the buttons layer to cover all the frames that were in my video layer. Then I created my start and stop buttons and my frame advance and previous frame buttons in that layer. I called them play_btn, stop_btn, prevframe_btn and nextframe_btn.


    Rather than attach an action script to the buttons themselves, I created an actionscript layer in the mediaclip timeline, again with enough frames to cover the whole .flv. Then I only had to type in the following code once:


    this.play_btn.onRelease = function() {
    play();
    }

    this.stop_btn.onRelease = function() {
    stop();
    }


    this.prevframe_btn.onRelease = function() {
    _root.gotoAndPlay(1);
    }

    this.nextframe_btn.onRelease = function() {
    _root.gotoAndPlay(4);
    }


    Note that "_root" is necessary in order to have the button take us out of the media clip timeline and back into the scene's timeline.


    Using the Component Inspector

    It took me a while to find the component inspector after I added the Media Component. Now I know where it is: Look in the Properties window after selecting the media component. There should be a button that says "Launch Component Inspector" under text saying "This component's parameters must be edited using the Component Inspector". You should then see two tabs on the right: Properties and Parameters. Click on Parameters.