Skip to content

Instantly share code, notes, and snippets.

@neodigm
Last active October 14, 2020 17:26
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save neodigm/3f74b31c1a12a92c08c3d90ce403998e to your computer and use it in GitHub Desktop.
Save neodigm/3f74b31c1a12a92c08c3d90ce403998e to your computer and use it in GitHub Desktop.
// Automotive Dealership stock photo gallery components (Adobe ActionScript 3.0)
import com.mosesSupposes.fuse.*;
import flash.external.*;
ZigoEngine.simpleSetup(Shortcuts, PennerEasing);
ZigoEngine.EASING = 'easeOutExpo';
ZigoEngine.DURATION = 5;
ZigoEngine.OUTPUT_LEVEL = 9;
var BASEURL:String = "http://www.neostudios.com/stockview/"; //hc
function MovieInit():Void
{
//
// Run 1st
//
_global.bResize = true;
//
configPlayer();
//
_root.Timeline_Logic.onEnterFrame = Movie_onEnter;
assignCmd();
_root.doLoadSwf1();
//
}
function Movie_onEnter():Void
{
//
// Root timeline
//
//
if(600 != _level0.stockphotos_container.ZOOM.Cell_Image._width){
if(_global.bResize){
if(0 != _level0.stockphotos_container.ZOOM.Cell_Image._width){
_global.bResize = false;
_level0.stockphotos_container.ZOOM.Cell_Image._width = 600;
_level0.stockphotos_container.ZOOM.Cell_Image._height = 340;
}
}
}
}
function setModel(sMake:String, sModel:String, sXML_BASE:String){
//
// Called from root swf - Make sure Im loaded before calling me
//
var sPath:String = sXML_BASE + sMake + "/" + sModel + "/";
_global.sPath = sPath;
Place(sPath);
}
function Place(sPath:String):Void
{
//
// Get the images based on a naming convention
//
var nCnt:Number = 1;
var sTmp:String = "";
//
_global.nNextCell = 0;
for(nCnt = 1; nCnt < 14; nCnt++){
sTmp = sPath + leadingZero(nCnt) + "_s.jpg?rnd=" + randRange(1, 2000);
var my_mcl:MovieClipLoader = new MovieClipLoader();
var myListener:Object = new Object();
myListener.onLoadComplete = function(target_mc:MovieClip) {
target_mc._parent._visible = true;
getNext(target_mc);
my_mcl.removeListener(myListener);
};
my_mcl.addListener(myListener);
my_mcl.loadClip(sTmp, _level0.stockphotos_container["Cell" + nCnt].Cell_Image);
_level0.stockphotos_container["Cell" + nCnt]._visible = false;
}
}
function getNext(mCell:MovieClip):Void
{
var nX:Number = 0;
var nY:Number = 0;
_global.nNextCell++;
switch(nNextCell){
case 1 :
nX = 35;
nY = 40;
break;
case 2 :
nX = 221;
nY = 40;
break;
case 3 :
nX = 407;
nY = 40;
break;
case 4 :
nX = 593;
nY = 40;
break;
case 5 :
nX = 35;
nY = 164;
break;
case 6 :
nX = 221;
nY = 164;
break;
case 7 :
nX = 407;
nY = 164;
break;
case 8 :
nX = 593;
nY = 164;
break;
case 9 :
nX = 35;
nY = 288;
break;
case 10 :
nX = 221;
nY = 288;
break;
case 11 :
nX = 407;
nY = 288;
break;
case 12 :
nX = 593;
nY = 288;
break;
}
mCell._parent.slideTo(nX, nY, 1);
}
function doIt(sCmd:String, nCell:Number):Void
{
//
// Major Application Actions
//
if("ZOOM" == sCmd){
var sTmp:String;
sTmp = _global.sPath + leadingZero(nCell) + "_l.jpg?rnd=" + randRange(1, 2000);
loadMovie(sTmp, _level0.stockphotos_container.ZOOM.Cell_Image);
_level0.stockphotos_container.ZOOM._y = randRange(-500, 500);
_level0.stockphotos_container.ZOOM.slideTo(randRange(16, 112), randRange(26, 64), .4);
_level0.stockphotos_container.ZOOM.Cell_Image._width = 600;
_level0.stockphotos_container.ZOOM.Cell_Image._height = 340;
_root.hideModels();
}
}
function assignCmd()
{
_level0.stockphotos_container.Cell1.onRelease = function() {
_level0.stockphotos_container.doIt("ZOOM", 1);
}
_level0.stockphotos_container.Cell2.onRelease = function() {
_level0.stockphotos_container.doIt("ZOOM", 2);
}
_level0.stockphotos_container.Cell3.onRelease = function() {
_level0.stockphotos_container.doIt("ZOOM", 3);
}
_level0.stockphotos_container.Cell4.onRelease = function() {
_level0.stockphotos_container.doIt("ZOOM", 4);
}
_level0.stockphotos_container.Cell5.onRelease = function() {
_level0.stockphotos_container.doIt("ZOOM", 5);
}
_level0.stockphotos_container.Cell6.onRelease = function() {
_level0.stockphotos_container.doIt("ZOOM", 6);
}
_level0.stockphotos_container.Cell7.onRelease = function() {
_level0.stockphotos_container.doIt("ZOOM", 7);
}
_level0.stockphotos_container.Cell8.onRelease = function() {
_level0.stockphotos_container.doIt("ZOOM", 8);
}
_level0.stockphotos_container.Cell9.onRelease = function() {
_level0.stockphotos_container.doIt("ZOOM", 9);
}
_level0.stockphotos_container.Cell10.onRelease = function() {
_level0.stockphotos_container.doIt("ZOOM", 10);
}
_level0.stockphotos_container.Cell11.onRelease = function() {
_level0.stockphotos_container.doIt("ZOOM", 11);
}
_level0.stockphotos_container.Cell12.onRelease = function() {
_level0.stockphotos_container.doIt("ZOOM", 12);
}
}
function FeedBack(sCmnd:String, sMsg:String):Void
{
}
function configPlayer():Void
{
_focusrect = false;
fscommand("fullscreen", false);
fscommand("allowscale", false);
fscommand("showmenu", false);
Button.prototype.swapDepths = MovieClip.prototype.swapDepths;
//
this._lockroot;
}
function n5AUDIO(sAudio:String, nVol:Number):Void
{
var Feedback_sound:Sound = new Sound();
Feedback_sound.attachSound(sAudio);
Feedback_sound.setVolume(nVol);
Feedback_sound.start(0,1);
Feedback_sound.setVolume(nVol);
}
function randRange(min:Number, max:Number):Number
{
var iRnd:Number = Math.floor(Math.random() * (max - min + 1)) + min;
return iRnd;
}
function leadingZero(nIn:Number):String
{
var sOut:String;
sOut = String(nIn);
if(1 == sOut.length){
sOut = "0" + sOut;
}
return sOut;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment