This is G o o g l e's cache of http://www.flashsandy.org/forum/index.php?act=Print&client=printer&f=9&t=425 as retrieved on 11 Jul 2007 01:05:21 GMT.
G o o g l e's cache is the snapshot that we took of the page as we crawled the web.
The page may have changed since that time. Click here for the current page without highlighting.
This cached page may reference images which are no longer available. Click here for the cached text only.
To link to or bookmark this page, use the following url: http://www.google.com/search?q=cache:xvQ7alFx2_oJ:www.flashsandy.org/forum/index.php%3Fact%3DPrint%26client%3Dprinter%26f%3D9%26t%3D425+act%3DPrint+%22index+php%22+-lofiversion+site:www.flashsandy.org&hl=en&ct=clnk&cd=8


Google is neither affiliated with the authors of this page nor responsible for its content.
These terms only appear in links pointing to this page: act print index php

Printable Version of Topic

Click here to view this topic in its original format

Sandy's Forum _ Discussion _ Working with Sandy 1.1 and Sandy 1.1 with a single code base

Posted by: zeusprod Mar 28 2007, 05:23 PM

I've been using Sandy 1.1 because it is stable, but I wanted to try out some things in Sandy 1.2.

I'd like to conditionally compile different parts of my code for each version (to handle the differences).

You can use a preprocessor to conditionally compile code as described here:

http://blog.pettomato.com/?p=5

I assume MTASC supports #IFDEF as well, but to my knowledge Flash 8 doesn't. (Call me a Luddite but I work in Flash 8's authoring environment).

I came up with a way to fool Flash's syntax checker to prevent compile-time errors.
WARNING: This also makes you lose the ability for Flash to warn you if your parameters are of the wrong type.

The basic trick is to use an untyped variable as the constructor name. Below, I use tmpCam and tmpScreen instead of Camera3D and ClipScreen, thus preventing compiler errors.

I define "version" variable as "1.1", or "1.2".


CODE

   var version = "1.1";

   var tmpCam = Camera3D;
  
   if (version == "1.1") {
      var tmpScreen = ClipScreen;
      var screen:ClipScreen = new tmpScreen(mc,250,250);
      var cam:Camera3D = new tmpCam(350,screen);
   } else {
      var cam:Camera3D = new tmpCam(350,350);// 1.2
   }


You can do similar things for other methods that vary between Sandy 1.1 and 1.2 (see the FAQ on the main web site for details on these)

For example, you can do this for enableBackFaceCulling, which is a property in Sandy 1.1 but a method in Sandy 1.2

CODE

   var version = "1.1";

   var tmpObj = theRealObj;
  
   if (version == "1.1") {
      tmpObj.enableBackFaceCulling = true;
   } else {
      tmpObj.enableBackFaceCulling (true);
   }


I'll clean this up and make it a technote at some point

The only thing you have to do manually is set the classPath to point to the correct Sandy library for 1.1 or 1.2.

You can address this by having two shell FLA files, each with different classpaths set under their Publish Settings.

Let me know if that isn't clear.

Cheers,
Bruce - zeusprod

Posted by: zeusprod Mar 28 2007, 05:42 PM

QUOTE(zeusprod @ Mar 28 2007, 12:23 PM) *


I'll clean this up and make it a technote at some point



Done!

See here:

http://www.flashsandy.org/multiversions

Posted by: Petit Mar 28 2007, 05:55 PM

QUOTE(zeusprod @ Mar 28 2007, 05:42 PM) *

I came up with a way to fool Flash's syntax checker to prevent compile-time errors.
WARNING: This also makes you lose the ability for Flash to warn you if your parameters are of the wrong type.

A cunning guy ideed this Bruce, aka zeusprod cool.gif

Posted by: zeusprod Mar 28 2007, 06:13 PM

Well, thanks again for your outstanding tutorials.

I used your VideoSkin example to get my video working today.

I had to compile in 1.1 and 1.2 to figure out which was the culprit (my code or the Sandy library).

Some other things I noticed about your video tutorial:

1. My class based on it failed until I made the net connection and net stream variables into properties (I originally had them as locals, so the connection/stream died).

2. It would help to mention people can right-click in the library and choose New Video to create a new video object. Maybe it is obvious, but I had never done it before. I mistakenly tried using an FLV Playback component which was not what your code was expecting.

3. My video still isn't playing. I think I need to initiate the play after I set the skin.

Cheers,
Bruce

Posted by: Petit Mar 28 2007, 09:01 PM

QUOTE(zeusprod @ Mar 28 2007, 06:13 PM) *

2. It would help to mention people can right-click in the library and choose New Video to create a new video object. Maybe it is obvious, but I had never done it before. I mistakenly tried using an FLV Playback component which was not what your code was expecting.
3. My video still isn't playing. I think I need to initiate the play after I set the skin.

Happy you like it, although I haven't come to the point of integrating all your corrections wink.gif
On point 2, you're right of course.
On point 3, I'd be surprised, but I haven't used video in 1.2, so I don't know.
By the way, are you using the released 1.2 beta 2, or the SVN updated version?

Posted by: zeusprod Mar 28 2007, 10:04 PM

QUOTE(Petit @ Mar 28 2007, 04:01 PM) *

By the way, are you using the released 1.2 beta 2, or the SVN updated version?


I'm using the latest from the SVN repository, including patches I've made.

I've committed the relevant patches

Posted by: kiroukou Mar 29 2007, 09:17 AM

Thanks again for your work on that!
I think you'll help a lot of people doing this.

While I'm stuck developping/testing the new version, this kind of help is really useful!

Posted by: zeusprod Mar 29 2007, 01:43 PM

QUOTE(kiroukou @ Mar 29 2007, 04:17 AM) *

Thanks again for your work on that!
I think you'll help a lot of people doing this.

While I'm stuck developping/testing the new version, this kind of help is really useful!



Now you understand my true motivation--enlightened self-interest.

I'm anxiously awaiting the new version too, so I'm doing the other stuff to benefit me as well (if it lets you focus on the new version)

Cheers,
Bruce

Posted by: kiroukou Mar 29 2007, 01:49 PM

QUOTE
I'm anxiously awaiting the new version too, so I'm doing the other stuff to benefit me as well (if it lets you focus on the new version)

It totally does smile.gif

you guys are really helping me to continue developing the new version. I hope to have franto and mirek back soon as developers..
The next version will be so good, that I can't wait myself to see it finished smile.gif

Posted by: zeusprod Mar 29 2007, 02:16 PM

QUOTE(kiroukou @ Mar 29 2007, 08:49 AM) *

The next version will be so good, that I can't wait myself to see it finished smile.gif


"It is even more succulent than I had imagined" - Poppy
;-)

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)