 Hi,
I want to be able to save the following animated plot as a flash.  There are ultimately 6 plots, but when I run this and save it as a flash all I get is the last (6th) plot, not all six different plots in order by "year".  I’ve tested the flash commands and they work; so it has to be my function code. I am guessing that the problem has something to do with overlaying the plot points, but I don’t know how to rewrite it and keep the animated elements.  
I am running R version 2..9.2 on Windows Vista. 
 
Data looks like this:
 
service usage amount year 
transport 11.33105 15.75016 2004 
transport 11.38398 15.82374 2005 
transport 11.44057 15.90239 2005 
 
Thanks!
 
ZdGibbs (I can provide a subset of the data as .txt if necessary).
 
#####order service year in ascending order and set frame options
library(animation)
library(lattice)
service <- service[order(service$year), ]
oopt = ani.options(interval = 1.0)
 
##### create the function
 
Service <- function (...) 
             {
 
interval = ani.options("interval")
index <- unique(service$year)
 
plot(amount~usage, data=service, type="n", xlab = " ", ylab = " ", bty="l", ylim=c(0,500))
 
legend("topright", legend=c("Transport", "Family", "Housing", "Substance Use", "Medical", "Mental Health"), pch=c(19,19,19,19,19,19), col=c("#7FC97F", "#BEAED4", "#FDC086", "#FFFF99", "#386CB0", "#F0027F"), bty="n", inset=.02)
             
for (i in 1:length(index)) {
rect(11.4, 425, 11.9, 500, col="white", border="red")
 
year.service <- service[which(service$year==index[i]),]
 
graphics <- year.service[year.service$service=="Graphics",]
                         
              trans <- year.service[year.service$service=="transport",]
              fam <- year.service[year.service$service=="family",]
              hous <- year.service[year.service$service=="housing",]
              subuse <- year.service[year.service$service=="subuse",]
              med <- year.service[year.service$service=="genhealth",]
              menhlth <- year.service[year.service$service=="mental health",]
                                     
text(mean(range(service$usage, na.rm=TRUE)), 455, index[i], col = rgb(0, 0, 0, 0.5), cex = 4)
points(amount~usage, data=trans, pch=19, col="#7FC97F")
points(amount~usage, data=fam, pch=19, col="#BEAED4")
points(amount~usage, data=hous, pch=19, col="#FDC086")
points(amount~usage, data=subuse, pch=19, col="#FFFF99")
points(amount~usage, data=med, pch=19, col="#386CB0")
points(amount~usage, data=menhlth, pch=19, col="#F0027F")
                         
            Sys.sleep(interval)
 
}
             
}
#####run animation
Service()
 
#####save as flash
oopt = ani.options(nmax = 6, interval = 1.0)
saveSWF(Service(), interval = 2.0, swfname="place.swf", dev = "pdf", filename="Pplot", fmt = "%03d", outdir = getwd(), swftools="C:/Program Files/SWFTools")
ani.options(oopt)


      
	[[alternative HTML version deleted]]


